Skip to main content

Module time

Module time 

Source
Expand description

Compact monotonic time utilities.

Uses a process-local monotonic clock for timestamps that are smaller than std::time::Instant (8 bytes vs 16 bytes for Option).

Constants§

NO_EXPIRY
Sentinel value meaning “no expiry”.

Functions§

expiry_from_duration
Converts a Duration to an absolute expiry timestamp.
is_expired
Returns true if the given expiry timestamp has passed.
now_ms
Returns current monotonic time in milliseconds since process start.
remaining_ms
Returns remaining TTL in milliseconds, or None if no expiry.
remaining_secs
Returns remaining TTL in seconds, or None if no expiry.