Documentation
¶
Overview ¶
Package clock abstracts time for testability. Every timeout, ticker or deadline in daemon control loops MUST go through a Clock so simcluster and unit tests can drive time deterministically with Fake.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
type Clock interface {
Now() time.Time
// After behaves like time.After.
After(d time.Duration) <-chan time.Time
// NewTicker behaves like time.NewTicker.
NewTicker(d time.Duration) Ticker
// Sleep blocks for d.
Sleep(d time.Duration)
}
Clock is the minimal time surface control loops need.
type Fake ¶
type Fake struct {
// contains filtered or unexported fields
}
Fake is a deterministic Clock driven by Advance. Timers fire synchronously inside Advance, in chronological order.
func NewFake ¶
func NewFake() *Fake
NewFake starts at a fixed, arbitrary epoch for reproducible tests.
Click to show internal directories.
Click to hide internal directories.