Skip to main content

Module timeutil

Module timeutil 

Source
Expand description

Time helpers for RFC3339 timestamps with consistent precision.

Responsibilities:

  • Parse RFC3339 timestamps for queue/reporting workflows.
  • Format timestamps with fixed 9-digit fractional seconds in UTC.
  • Provide a testable fallback mechanism for formatting failures.

Does not handle:

  • Parsing non-RFC3339 timestamp formats.
  • Guessing or inferring time zones for naive timestamps.

Invariants/assumptions:

  • Callers provide RFC3339 strings when parsing.
  • Formatted timestamps are always UTC with 9-digit subseconds.
  • Formatting errors are logged and result in a sentinel fallback value.

Re-exports§

pub use crate::constants::defaults::FALLBACK_RFC3339;

Functions§

format_rfc3339
now_utc_rfc3339
now_utc_rfc3339_or_fallback
Returns the current UTC timestamp in RFC3339 format, or a sentinel fallback on error.
parse_relative_time
Parse a relative or absolute time expression into RFC3339.
parse_rfc3339
parse_rfc3339_opt