Expand description
The workspace’s clock.
Every crate in the workspace reads the time through this module and never
through std::time::Instant or std::time::SystemTime directly. On every
target but one, this module is std::time and nothing else: the types are
the standard library’s own, so a value crosses any API that names
std::time unchanged.
The exception is wasm32-unknown-unknown, the browser target. There the
standard library compiles Instant::now() and SystemTime::now() and
makes both panic when called, because the target defines no host clock. A
green build therefore says nothing; the first tick of the engine aborts the
module. On that target this module re-exports web-time, which reads
performance.now() and Date.now() and has the same API.
clocks_are_read_through_core_time_only in this crate walks every crate’s
sources and refuses a direct std::time clock import, because nothing else
notices one until it runs in a browser.
Structs§
- Duration
- A
Durationtype to represent a span of time, typically used for system timeouts. - Instant
- A measurement of a monotonically nondecreasing clock.
Opaque and useful only with
Duration. - System
Time - A measurement of the system clock, useful for talking to external entities like the file system or other processes.
- System
Time Error - An error returned from the
duration_sinceandelapsedmethods onSystemTime, used to learn how far in the opposite direction a system time lies.
Constants§
- UNIX_
EPOCH - An anchor in time which can be used to create new
SystemTimeinstances or learn about where in time aSystemTimelies.