package
Version:
v0.1.2
Opens a new window with list of versions in this module.
Published: Oct 7, 2026
License: Apache-2.0
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Package clock gives code that depends on the time a replaceable source of it, so tests
can control expiry, long-poll timeouts and timestamps exactly.
Clock tells the time and makes timers.
Fake is a clock that only moves when Advance is called.
NewFake returns a fake clock set to t.
Advance moves the clock forward by d and fires every timer that is now due.
After fires once Advance moves the clock d or more past the current fake time.
Next returns when the earliest timer waiting for the clock to move fires, and false
when none waits.
Now returns the fake time.
Waiters returns how many timers wait for the clock to move, so a test can move it once
everything it expects is waiting.
Real is the system clock.
After waits for d on the system clock.
Now returns the current time.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.