Expand description
System-owned UTC and monotonic clocks. UTC is invalid until explicitly seeded.
Native/browser runtimes bootstrap once through their typed TimeDevice source.
Their host clock is trusted as the epoch supplier, not certified as accurate;
subsequent host clock changes require explicit resynchronization.
A target with no RTC can start the clock before any shell or network service:
use time::{ClockSource, Manager, RealtimeSample, Timestamp};
use core::time::Duration;
let clock = Manager::unsynchronized();
// Runtime policy validates the manual value (or obtains it from an RTC/network).
clock.set_realtime(RealtimeSample {
timestamp: Timestamp::from_nanos(1_700_000_000_000_000_000),
source: ClockSource::Manual,
resolution: Duration::from_secs(1),
accuracy: None,
}).unwrap();The API does not implement a synchronization protocol, timezone, persistence, authentication or automatic source fallback. Unsynchronized reads fail; current unsigned filesystem and WASI formats also reject pre-epoch/out-of-range UTC.
Structs§
- Embassy
Clock - The executor’s Embassy clock, shared with task timers and WASI deadlines.
- Manager
- System-owned UTC clock anchored to monotonic time, independent of shell lifetime.
- Realtime
Sample - An epoch sample supplied by a platform or synchronization service.
- Realtime
Status - No synchronization means UTC is invalid, regardless of the monotonic reading. The correction starts at zero and is reset by explicit invalidation; it is replaced (never accumulated) by each successful set operation.
- Synchronization
- Timestamp
- Signed nanoseconds since 1970-01-01 00:00:00 UTC, without timezone or DST. Leap seconds follow the supplying source’s Unix/POSIX time convention. The full i128 range is representable; conversions and clock arithmetic are checked.
Enums§
- Clock
Source - Provenance claimed by a trusted runtime caller, not an authentication mechanism.
- Error
Constants§
- MONOTONIC_
RESOLUTION - Nominal resolution of the default monotonic source, rounded up to nanoseconds. Actual precision can be coarser (for example, browser privacy restrictions).
Traits§
- Monotonic
Clock - An elapsed-time source with a stable, arbitrary epoch.
- Realtime
Source - A trustworthy Unix epoch source: RTC driver, host, manual input or network service.