clock.go 334 B

123456789101112131415161718
  1. package congestion
  2. import "time"
  3. // A Clock returns the current time
  4. type Clock interface {
  5. Now() time.Time
  6. }
  7. // DefaultClock implements the Clock interface using the Go stdlib clock.
  8. type DefaultClock struct{}
  9. var _ Clock = DefaultClock{}
  10. // Now gets the current time
  11. func (DefaultClock) Now() time.Time {
  12. return time.Now()
  13. }