This package provides an abstraction layer for all the time-passage-dependent features from the standard Go time package. This allows code to be written once and run on different clocks, e.g. for testing or for "replay" applications.
v0.1 Edge: Breaking changes to the API unlikely but possible until the v1.0 release. May be robust enough to use in production, though provided on "AS IS" basis. Vendoring recommended.
This package is under active development. If you encounter any problems or have any suggestions for improvement, please open an issue. Pull requests are welcome.
The Clock
interface groups all the time-passage-dependent features from the standard time package. A Timer
and a Ticker
interface are included to allow abstraction of these concepts.
A "live" Clock is provided in this package giving pass-through access to the standard functionality.
A "manual" Clock is included as a separate package, because it is mostly useful for testing and it is rarely if ever needed in the actual program.
go get github.com/agext/clocks
Package clocks is released under the Apache 2.0 license. See the LICENSE file for details.