Documentation
¶
Overview ¶
Package clock tells the time through an interface, so tests can set it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMockClock ¶
func NewMockClock(now time.Time) (Service, TimeSetterFn)
NewMockClock returns a clock that always returns now, and a function that changes the time it returns. Both are safe to call from several goroutines.
Types ¶
type Service ¶
Service tells the current time.
func NewSystemClock ¶
func NewSystemClock() Service
NewSystemClock returns a clock that returns time.Now.
type TimeSetterFn ¶
TimeSetterFn sets the time that a mock clock returns.
Click to show internal directories.
Click to hide internal directories.