pub enum WallClock {
System,
OffsetMs(i64),
Custom(fn(u64) -> i64),
}Expand description
Zero-allocation wall-clock epoch source mapping monotonic now_ms to Unix epoch milliseconds.
Shared by wall-clock FrameTickHook consumers (date-text, progress). On wasm32,
std::time::SystemTime::now() is unavailable, so callers construct an explicit
Self::offset_ms or Self::custom clock instead of falling back to 1970.
Variants§
System
Reads std::time::SystemTime::now() on native targets.
OffsetMs(i64)
Deterministic wall clock anchored at epoch_ms_at_zero + now_ms.
Custom(fn(u64) -> i64)
Zero-allocation callback mapping monotonic now_ms to Unix epoch milliseconds.
Implementations§
Source§impl WallClock
impl WallClock
Sourcepub const fn system() -> Self
pub const fn system() -> Self
Uses the OS wall clock (SystemTime::now()). Unavailable on wasm32.
Sourcepub const fn offset_ms(epoch_ms_at_zero: i64) -> Self
pub const fn offset_ms(epoch_ms_at_zero: i64) -> Self
Deterministic wall clock anchored at epoch_ms_at_zero + now_ms.
Sourcepub const fn custom(f: fn(u64) -> i64) -> Self
pub const fn custom(f: fn(u64) -> i64) -> Self
Custom zero-allocation clock mapping monotonic now_ms to Unix epoch milliseconds.
Sourcepub fn now_epoch_ms(self, now_ms: u64) -> i64
pub fn now_epoch_ms(self, now_ms: u64) -> i64
Evaluates the Unix epoch timestamp in milliseconds at monotonic now_ms.