Skip to main content

Module clock

Module clock 

Source
Expand description

A monotonic clock for the kernel’s diagnostic timings, on every target.

Instant is std::time::Instant wherever the standard library has a clock: native targets and WASI. On wasm32-unknown-unknown the standard library has none and std::time::Instant::now panics there, so this one reads as a fixed point and every duration is zero. With the web feature it reads the browser’s performance.now() instead.

Timings are diagnostics. No answer of any operation depends on them, so a clock that reads zero changes what a report says about time and nothing else. std::time::Instant::now is refused by clippy (disallowed-methods in clippy.toml) in the kernel’s crates.

Structs§

Instant
A point in time, measured by the platform’s monotonic clock where it has one.