Skip to main content

Module time

Module time 

Source
Expand description

The toolkit’s clock: tilo-clock, under the toolkit’s module path.

Every monotonic and wall-clock reading in ui goes through now and wall, and every clock type is named through this module rather than std::time. A process that has no process clock of its own (or one that must be virtualised, such as a deterministic replay) then has exactly one boundary to provide, instead of a hundred scattered Instant::now() calls.

On targets with a native clock the re-exports are std::time’s own types, so values cross freely into crates that name std::time directly.

crates/ui/ui-core/clippy.toml rejects Instant::now and SystemTime::now everywhere else in the crate.

Structs§

Duration
A Duration type 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.
SystemTime
A measurement of the system clock, useful for talking to external entities like the file system or other processes.
SystemTimeError
An error returned from the duration_since and elapsed methods on SystemTime, 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 SystemTime instances or learn about where in time a SystemTime lies.

Functions§

from_file_time
A file-system timestamp, as std::fs::Metadata::modified reports it, in the toolkit’s SystemTime.
from_std
is_synchronised
Whether the device’s clock is synchronised, when the platform can say; None when nothing here knows.
local_zone_name
now
pin_wall
Pin the wall clock of the whole process to at for a screenshot capture, so every frame shows the same date. The monotonic clock keeps running.
to_std
try_unix_now
try_unix_now_ms
try_unix_now_ns
unix_now
unix_now_i64
unix_now_ms
unix_now_ms_i64
unix_now_ns
wall
wall_frozen
Whether a clock is held here, so a wall read answers the hold.