Expand description
Time, duration, and UTC date/time helpers.
Structs§
- Civil
Date - A proleptic Gregorian calendar date.
- Civil
Date Time - A UTC civil date and wall-clock time with whole-second precision.
- Fixed
Clock - Deterministic clock for tests and reproducible harnesses.
- System
Clock - System-backed clock.
Traits§
- Clock
- Clock used for wall-clock timestamps and monotonic elapsed durations.
Functions§
- civil_
from_ days - Converts a count of days since the Unix epoch to a civil date.
- datetime_
from_ epoch_ secs - Converts Unix epoch seconds to a UTC civil date/time.
- days_
from_ civil - Converts a valid civil date to its day offset from the Unix epoch.
- days_
in_ month - Returns the number of days in
monthforyear, orNonefor invalid months. - elapsed_
millis - Returns the non-negative elapsed milliseconds between two monotonic millisecond readings.
- epoch_
secs_ from_ datetime - Converts a valid UTC civil date/time to Unix epoch seconds.
- format_
compact_ utc - Formats a Unix timestamp (whole seconds) as compact UTC
YYYYMMDD-HHMMSS. - format_
duration - Formats a
Durationinto a human-readable string. - format_
rfc3339 - Formats a Unix timestamp (whole seconds) as a UTC RFC 3339 string
(
YYYY-MM-DDTHH:MM:SSZ). - format_
rfc3339_ datetime - Formats a valid UTC civil date/time as
YYYY-MM-DDTHH:MM:SSZ. - is_
leap_ year - Returns
truewhenyearis a leap year in the proleptic Gregorian calendar. - now_
epoch_ secs - Returns the current Unix epoch time in whole seconds, or
Noneif the system clock is set before the Unix epoch or exceedsi64. - now_
rfc3339 - Returns the current wall-clock time as a UTC RFC 3339 string, or
Noneif the system clock is set before the Unix epoch or exceedsi64. - now_utc
- Returns the current UTC civil date/time, or
Noneif the system clock is set before the Unix epoch or exceedsi64. - parse_
duration - Parses simple duration strings like
"5s","10m","1h"into aDuration. Case-insensitive, supports optional space, and treats unit-less values as seconds. - parse_
rfc3339_ utc - Parses a canonical UTC RFC 3339 timestamp into Unix epoch seconds.
- parse_
rfc3339_ utc_ datetime - Parses a canonical UTC RFC 3339 timestamp into a UTC civil date/time.
- system_
clock - Return a shared system-backed clock.
- time_it
- Runs a synchronous function and returns a tuple containing its return value and the exact execution time.
Type Aliases§
- Shared
Clock - Shared clock handle.