package
Version:
v0.3.2
Opens a new window with list of versions in this module.
Published: Mar 25, 2026
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Package clock provides an interface around the standard library's time package so that unit tests can inject a mock
clock.
type Clock interface {
Now() time.Time
}
Clock represents a source of the current time.
Mock returns a Clock that reads the MOCK_TIME env variable if set to an RFC3339 timestamp,
otherwise it uses time.Now.
Func is an adapter that allows a function returning time.Time (such as time.Now) to satisfy the Clock interface.
Now returns the time produced by the underlying function.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.