You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
505 B
24 lines
505 B
package clock |
|
|
|
import ( |
|
"time" |
|
) |
|
|
|
// DefaultClock implements Clock interface by simply calling the appropriate |
|
// time functions. |
|
type DefaultClock struct{} |
|
|
|
// NewDefaultClock constructs a new DefaultClock. |
|
func NewDefaultClock() Clock { |
|
return &DefaultClock{} |
|
} |
|
|
|
// Now simply returns time.Now(). |
|
func (DefaultClock) Now() time.Time { |
|
return time.Now() |
|
} |
|
|
|
// TickAfter simply wraps time.After(). |
|
func (DefaultClock) TickAfter(duration time.Duration) <-chan time.Time { |
|
return time.After(duration) |
|
}
|
|
|