Skip to main content

current_time_ms

Function current_time_ms 

Source
pub fn current_time_ms() -> u64
Available on crate feature hook only.
Expand description

Returns current time as milliseconds since UNIX epoch.

Audit fix #20: This is the canonical implementation used across the hook layer. The private duplicate in mutation_bucket.rs (now_ms) should ideally be consolidated here or into a shared utility module.

§Clock-before-epoch fallback

duration_since(UNIX_EPOCH) errors if the system clock reports a time before the Unix epoch (e.g. a misconfigured RTC or a clock skewed backwards on cold boot). The .unwrap_or_default() silently clamps that case to a Duration::ZERO, so this function returns 0. Callers treat 0 as “ancient”, which makes the only observable effect under a broken clock be that stale entries become immediately eligible for garbage collection; no panic or error is propagated. This mirrors the silent-clamp behavior of the current_time_ms in client::erased so both clock sources stay consistent.