Versions in this module Expand all Collapse all v1 v1.0.0 Aug 25, 2026 Changes in this version + const MaxObservationTagBytes + const MaxObservationTags + var ErrInvalidCallback = errors.New("clock: invalid callback") + var ErrInvalidClock = errors.New("clock: invalid clock") + var ErrInvalidDuration = errors.New("clock: invalid duration") + var ErrInvalidObserver = errors.New("clock: invalid observer") + var ErrObservationTags = errors.New("clock: invalid observation tags") + var ErrOverflow = errors.New("clock: duration overflow") + type Callback interface + Reset func(time.Duration) (bool, error) + Stop func() bool + type CallbackClock interface + AfterFunc func(time.Duration, func()) (Callback, error) + type Clock interface + Now func() time.Time + type ElapsedClock interface + Measure func() func() time.Duration + Since func(time.Time) time.Duration + type FullClock interface + func Observe(base FullClock, observer Observer, options ...ObserveOption) (FullClock, error) + type Kind string + const KindCallback + const KindSleep + const KindTicker + const KindTimer + type Observation struct + Elapsed time.Duration + Kind Kind + Outcome Outcome + Requested time.Duration + Tags map[string]string + type ObserveOption func(*observeConfig) error + func WithTags(tags map[string]string) ObserveOption + type Observer interface + Observe func(Observation) + type ObserverFunc func(Observation) + func (function ObserverFunc) Observe(observation Observation) + type Outcome string + const OutcomeCanceled + const OutcomeCompleted + const OutcomeCreated + const OutcomeFired + const OutcomeInactive + const OutcomePanicked + const OutcomeRejected + const OutcomeReset + const OutcomeStopped + type Sleeper interface + Sleep func(context.Context, time.Duration) error + type System struct + func (System) AfterFunc(d time.Duration, fn func()) (Callback, error) + func (System) Measure() func() time.Duration + func (System) NewTicker(d time.Duration) (Ticker, error) + func (System) NewTimer(d time.Duration) (Timer, error) + func (System) Now() time.Time + func (System) Since(start time.Time) time.Duration + func (System) Sleep(ctx context.Context, d time.Duration) error + type Ticker interface + C func() <-chan time.Time + Reset func(time.Duration) error + Stop func() + type TickerFactory interface + NewTicker func(time.Duration) (Ticker, error) + type Timer interface + C func() <-chan time.Time + Reset func(time.Duration) (bool, error) + Stop func() bool + type TimerFactory interface + NewTimer func(time.Duration) (Timer, error)