Documentation
¶
Overview ¶
Package clock provides monotonic clocks for live execution and deterministic replay.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrBackwards = errors.New("monotonic clock cannot move backwards")
Functions ¶
This section is empty.
Types ¶
type Manual ¶
type Manual struct {
// contains filtered or unexported fields
}
Manual is a deterministic Scheduler for tests. Advancing it fires every timer whose deadline has passed, in deadline then scheduling order, with the clock already set to that timer's deadline so a callback that reads the time sees the moment it was scheduled for rather than the moment advancing ended.
func (*Manual) AdvanceToNS ¶
AdvanceToNS moves the clock to an absolute time and fires everything due.
type Scheduler ¶
Scheduler is a clock that can also schedule future work. Components that must act when nothing external happens - a playout horizon passing, a deadline expiring - take a Scheduler so tests can drive time explicitly rather than sleeping.
type System ¶
type System struct {
// contains filtered or unexported fields
}
type Timer ¶
type Timer interface {
// Stop cancels the timer and reports whether it stopped it before it ran.
Stop() bool
}
Timer is a scheduled callback that has not necessarily fired yet.
type Virtual ¶
type Virtual struct {
// contains filtered or unexported fields
}