|
|
@ -84,6 +84,9 @@ type Clock interface {
|
|
|
|
// by this Clock. When the ticker expires, it will call the provided func.
|
|
|
|
// by this Clock. When the ticker expires, it will call the provided func.
|
|
|
|
// It follows the semantics of time.AfterFunc.
|
|
|
|
// It follows the semantics of time.AfterFunc.
|
|
|
|
AfterFunc(d time.Duration, f func()) TimerController
|
|
|
|
AfterFunc(d time.Duration, f func()) TimerController
|
|
|
|
|
|
|
|
// Since returns the time elapsed since t.
|
|
|
|
|
|
|
|
// It follows the semantics of time.Since.
|
|
|
|
|
|
|
|
Since(t time.Time) time.Duration
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// TickerController offers the receivers of a time.Ticker to ensure
|
|
|
|
// TickerController offers the receivers of a time.Ticker to ensure
|
|
|
@ -135,3 +138,8 @@ func (StdClock) NewTicker(d time.Duration) (TickerController, <-chan time.Time)
|
|
|
|
func (StdClock) AfterFunc(d time.Duration, f func()) TimerController {
|
|
|
|
func (StdClock) AfterFunc(d time.Duration, f func()) TimerController {
|
|
|
|
return time.AfterFunc(d, f)
|
|
|
|
return time.AfterFunc(d, f)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Since calls time.Since.
|
|
|
|
|
|
|
|
func (StdClock) Since(t time.Time) time.Duration {
|
|
|
|
|
|
|
|
return time.Since(t)
|
|
|
|
|
|
|
|
}
|
|
|
|