Expand description
The wall clock that timestamps use (§7.2); the only reader of system time.
Structs§
- Closure
Clock - A clock that calls a supplied function on every read.
- Fixed
Clock - A clock that returns the instant supplied by a test until it is set again.
- Polling
Clock - 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_waitsis set. It records eachwait_outit is given. - System
Clock - The system wall clock.
Enums§
- Wall
Timer Error - 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-afterperiods in.config/nextest.toml, which stays a period above this so the test’s own report of where it hung prints first;clock_testschecks it.
Traits§
- Clock
- The wall clock that timestamps use (§7.2).
Functions§
- wait_
out_ hang_ guard - Block this thread for
HANG_GUARDof real time: what a test process’s hang report waits out before it prints. - within
future’s output, orNoneonceHANG_GUARDof real time passes first: a test waiting on the system fails instead of hanging, whatever clock the store under it reads.
Type Aliases§
- Clock
Ref - A shared wall clock, supplied when the store opens.