Skip to main content

Crate lean_ctx_time

Crate lean_ctx_time 

Source
Expand description

Time for LeanCTX: UTC instants, signed durations and their text formats.

A thin layer over jiff. LeanCTX stores timestamps in state files, signs them into receipts and sends them over its wire contracts, so this crate keeps every format LeanCTX has always written byte for byte:

Parsing accepts what LeanCTX has always accepted: strict RFC 3339 in UtcDateTime::parse_from_rfc3339, and the relaxed form (spaces before the offset, UTC, offsets without a colon) in FromStr and serde.

Re-exports§

pub use jiff;

Modules§

format
strftime and the fixed text formats.

Structs§

CivilDateTime
A date and wall-clock time without a time zone (chrono’s NaiveDateTime). A representation of a civil datetime in the Gregorian calendar.
Date
A calendar date without a time zone (chrono’s NaiveDate). A representation of a civil date in the Gregorian calendar.
Duration
A signed span of time with nanosecond precision.
LocalDateTime
An instant in the system time zone, for text shown to people.
OffsetDateTime
An instant together with a fixed UTC offset, as parsed from RFC 3339.
OutOfRangeError
The value is outside the range the target type can hold.
ParseError
Why a date and time string did not parse.
Time
A wall-clock time without a date or time zone (chrono’s NaiveTime). A representation of civil “wall clock” time.
UtcDateTime
An instant in UTC with nanosecond precision.

Enums§

SecondsFormat
How many fractional digits UtcDateTime::to_rfc3339_opts writes.

Functions§

days_between
Whole days from earlier to later (negative when later is earlier), like chrono’s (later - earlier).num_days().
parse_civil_datetime
Parses a date and wall-clock time with a strftime pattern, like parse_date. A leap second (:60) reads as :59.
parse_date
Parses a calendar date with a strftime pattern.
utc_from_civil
dt read in UTC; None only in the first and last day of jiff’s range.
utc_from_local_civil
dt read as wall-clock time in the system time zone. A repeated hour (DST fold) takes the earlier instant; a skipped hour (DST gap) reads dt as UTC, at most one DST shift off. None only at jiff’s range edges.