Documentation
¶
Overview ¶
Package clock abstracts time.Now for testability so that higher layers can inject fake clocks in unit tests without coupling to the wall clock.
Package clock — hosts compile-time interface assertions — keeping them out of the production source so the runtime binary carries no diagnostic-only declarations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
type Clock interface {
// Now returns the current instant.
Now() time.Time
// Since returns the elapsed duration between the given instant and Now.
Since(t time.Time) time.Duration
}
Clock produces timestamps and durations. Implementations must be safe for concurrent use by multiple goroutines.
var System Clock = systemClock{}
System is the default Clock using the package time wall clock.
Click to show internal directories.
Click to hide internal directories.