Skip to main content

Module clock

Module clock 

Source
Expand description

Clock types that also work in the browser.

std::time::Instant and std::time::SystemTime panic on wasm32-unknown-unknown, so on WASM these come from web_time, which reads the JS clocks instead.

Structs§

Instant
A measurement of a monotonically nondecreasing clock. Opaque and useful only with Duration.
SystemTime
A measurement of the system clock, useful for talking to external entities like the file system or other processes.

Constants§

UNIX_EPOCH
An anchor in time which can be used to create new SystemTime instances or learn about where in time a SystemTime lies.

Functions§

now
Wall-clock reading. On native this is std::time::SystemTime::now(); on WASM it goes through Date.now() so it doesn’t panic on wasm32-unknown-unknown.
timestamp_secs
The current unix timestamp in seconds.