Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 2.9% on proxy.golang.org
Top 0.4% dependent packages on proxy.golang.org
Top 0.2% dependent repos on proxy.golang.org
Top 7.8% forks on proxy.golang.org
Top 0.2% docker downloads on proxy.golang.org

proxy.golang.org : github.com/jmhodges/clock

Package clock provides an abstraction for system time that enables testing of time-sensitive code. Where you'd use time.Now, instead use clk.Now where clk is an instance of Clock. When running your code in production, pass it a Clock given by clock.Default() and when you're running it in your tests, pass it an instance of Clock from NewFake(). When you do that, you can use FakeClock's Add and Set methods to control how time behaves in your tests. That makes the tests you'll write more reliable while also expanding the space of problems you can test. This code intentionally does not attempt to provide an abstraction over time.Ticker and time.Timer because Go does not have the runtime or API hooks available to do so reliably. See https://github.com/golang/go/issues/8869

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/jmhodges/clock
License: MIT
Latest release: over 2 years ago
First release: over 2 years ago
Namespace: github.com/jmhodges
Dependent packages: 115
Dependent repositories: 1,977
Stars: 51 on GitHub
Forks: 6 on GitHub
Docker dependents: 81
Docker downloads: 714,665,026
See more repository details: repos.ecosyste.ms
Last synced: 12 days ago

    Loading...
    Readme
    Loading...