Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IClock ¶
type IClock interface {
// Now returns current time
Now() time.Time
// After returns a channel that will send one and only one
// timestamp once it waited for the given duration
//
// Implementation of this method needs to guarantee that
// the returned time is either equal or greater than the given
// one plus duration
After(time.Duration) <-chan time.Time
// Until returns a channel that will send one and only one
// timestamp once the provided time has occurred
//
// Implementation of this method needs to guarantee that
// the returned time is either equal or greater than the given
// one
Until(time.Time) <-chan time.Time
// Changes returns a channel that will send a message when
// the clock detects a change (in case of a real clock, can
// be a significant drift forward, or a drift backward; for
// mock clock, an explicit change)
Changes() <-chan time.Time
}
IClock is a generic interface for clocks
func FromContext ¶
FromContext retrieves a Clock from a given context, if there's any. If there's none, it'll create a Host clock
Click to show internal directories.
Click to hide internal directories.