Documentation
¶
Overview ¶
Package timekeeper defines an interface to allow switching between real time and simulated time.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TimeKeeper ¶
type TimeKeeper interface {
// After waits for the duration to elapse and then sends the current
// time on the returned channel.
After(d time.Duration) <-chan time.Time
// Sleep pauses the current goroutine for at least the duration d. A
// negative or zero duration causes Sleep to return immediately.
Sleep(d time.Duration)
// Current time.
Now() time.Time
}
TimeKeeper is meant as a drop-in replacement for using the time package directly, and allows testing code to substitute a suitable implementation. The meaning of duration and current time depends on the implementation (may be a simulated time).
Click to show internal directories.
Click to hide internal directories.