This clock implementation takes inspiration from https://github.com/agilira/go-timecache but works with our clock.Clock interface CachedClock implements the Clock interface using a cached atomic value to avoid the overhead of system calls from time.Now().
| 12 | // CachedClock implements the Clock interface using a cached atomic value |
| 13 | // to avoid the overhead of system calls from time.Now(). |
| 14 | type CachedClock struct { |
| 15 | nanos atomic.Int64 |
| 16 | resolution time.Duration |
| 17 | ticker *time.Ticker |
| 18 | done chan struct{} |
| 19 | } |
| 20 | |
| 21 | // NewCachedClock creates a new CachedClock that uses the system time cached every [resolution]. |
| 22 | // |
nothing calls this directly
no outgoing calls
no test coverage detected