Expand description
ISO 8601 / RFC 3339 / RFC 2822 parsing and formatting for Time<UTC>
and (via scale conversion) Time<TAI>.
The civil layer is chrono-backed today (chrono is a hard dependency
of tempoch-core); this module wraps the conversion to provide:
- Subsecond precision configurable from 0..9 digits.
FormatPrecision::{Truncate, RoundHalfToEven}rounding policy.- Leap-second-aware formatting:
23:59:60[.x]is emitted iff the instant lands during an announced positive leap second, and accepted on parse. - A small
FormatOptionsvalue type so callers can opt into different subsecond/leap-second/timezone formatting policies without affecting the existingchronobridge.
The conversion goes through Time<UTC, J2000s> storage, so the
resulting instants are usable on any scale via the unified
to::<Scale>() / to_with::<Scale>() API.
§Examples
use tempoch_core::format::iso::FormatOptions;
use tempoch_core::{Time, UTC};
let t = Time::<UTC>::parse_rfc3339("2024-06-15T12:34:56.789Z").unwrap();
let s = t.format_rfc3339(FormatOptions::milliseconds());
assert!(s.starts_with("2024-06-15T12:34:56.789"));Structs§
- Format
Options - Format options for ISO 8601 / RFC 3339 output.
Enums§
- Format
Precision - Subsecond rounding policy used by the formatter.
Functions§
- parse_
rfc3339_ utc - Parse an RFC 3339 timestamp into the canonical UTC
J2000sstorage. - parse_
rfc3339_ utc_ with - Like
parse_rfc3339_utc, but uses an explicitTimeContext.