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
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.
Functions§
- from_
file_ time - from_
std - is_
synchronised - Whether the device’s clock is synchronised, when the platform can say;
Nonewhen nothing here knows. - local_
zone_ name - now
- pin_
wall - A clock held at one wall time; tilo-clock’s own tests hold it per thread instead.
Pin the wall clock of the whole process to
atfor 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.