Skip to main content

Module clock

Module clock 

Source
Expand description

The wall clock that timestamps use (§7.2); the only reader of system time.

Structs§

ClosureClock
A clock that calls a supplied function on every read.
FixedClock
A clock that returns the instant supplied by a test until it is set again.
PollingClock
A fixed clock whose waits end only as its time reaches them. A backoff or cooldown the code waits out passes as the code arms it: this clock moves the fixed clock to the wait’s end, as the wait’s passing would, so retries run without real time and their timestamps are the waits the code chose. A deadline, which work races, and the idle interval end only when the test moves the clock, as does every wait once hold_waits is set. It records each wait_out it is given.
SystemClock
The system wall clock.

Enums§

WallTimerError
A clock couldn’t wait for a wall-clock time (§13.2): the system refused its timer, or the clock has none.

Constants§

HANG_GUARD
How long a test waits on an event before failing instead of hanging. Every wait it bounds ends on the code’s own event, so only code that never sends it reaches this. It is not a measure of speed, so it sits far above what any step takes on a loaded machine (the slowest whole tests take about 260s there). nextest ends a test at terminate-after periods in .config/nextest.toml, which stays a period above this so the test’s own report of where it hung prints first; clock_tests checks it.

Traits§

Clock
The wall clock that timestamps use (§7.2).

Functions§

wait_out_hang_guard
Block this thread for HANG_GUARD of real time: what a test process’s hang report waits out before it prints.
within
future’s output, or None once HANG_GUARD of real time passes first: a test waiting on the system fails instead of hanging, whatever clock the store under it reads.

Type Aliases§

ClockRef
A shared wall clock, supplied when the store opens.