This package provides a ticking clock that allows you to set the start time. It also provides a system clock and a fixed clock, all implementing this interface:
// Clock provides the sub set of methods in time.Time that this package provides.
type Clock interface {
Now() time.Time
Since(t time.Time) time.Duration
Until(t time.Time) time.Duration
// Offset returns the offset of this clock relative to the system clock.
Offset() time.Duration
}
Note that this only support a subset of all the methods in time.Time
(see above) and is by design very simple. If you're looking for a more advanced time mocking library, have a look at https://github.com/benbjohnson/clock.