Documentation ¶
Overview ¶
Package mclock is a wrapper for a monotonic clock source
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbsTime ¶
type AbsTime int64
AbsTime represents absolute monotonic time.
type ChanTimer ¶
type ChanTimer interface { Timer // The channel returned by C receives a value when the timer expires. C() <-chan AbsTime // Reset reschedules the timer with a new timeout. // It should be invoked only on stopped or expired timers with drained channels. Reset(time.Duration) }
ChanTimer is a cancellable event created by NewTimer.
type Clock ¶
type Clock interface { Now() AbsTime Sleep(time.Duration) NewTimer(time.Duration) ChanTimer After(time.Duration) <-chan AbsTime AfterFunc(d time.Duration, f func()) Timer }
The Clock interface makes it possible to replace the monotonic system clock with a simulated clock.
type System ¶
type System struct{}
System implements Clock using the system clock.
Click to show internal directories.
Click to hide internal directories.