now! : () => Utc
Read the current time from the system clock.
A clock set before 1970 gives a negative instant rather than an error or the epoch.
Utc :: # (opaque)
A point in calendar time: signed nanoseconds since the Unix epoch, 1970-01-01T00:00:00Z. Instants before 1970 are negative.
Utc values support == and the ordering operators and sort with
List.sort. The time between two of them is a Duration, from
Utc.since. To measure how long something took, prefer Monotonic, which
is unaffected by changes to the wall clock.
Every result is clamped to what its type holds, so nothing here crashes on
overflow: a Utc to the I128 range, a Duration to zero and its maximum.
now! : () => Utc
Read the current time from the system clock.
A clock set before 1970 gives a negative instant rather than an error or the epoch.
from_nanos_since_epoch : I128 -> Utc
The instant a number of nanoseconds after the Unix epoch, or before it when negative.
to_nanos_since_epoch : Utc -> I128
Nanoseconds from the Unix epoch to this instant, negative before 1970.
from_millis_since_epoch : I128 -> Utc
The instant a number of milliseconds after the Unix epoch, or before it when negative, clamped to the representable range.
to_millis_since_epoch : Utc -> I128
Whole milliseconds from the Unix epoch to this instant, negative before
is millisecond -1.
since : Utc, Utc -> Duration
The time from an earlier instant to this one: later.since(earlier).
The arguments are directional. When earlier is in fact the later
instant the result is Duration.zero, and a span too long for a
Duration is clamped to the longest one.
stale = Utc.now!().since(path.time_modified!()?) > Duration.minutes(5)
to_iso_8601 : Utc -> Str
Format this instant as an ISO 8601 UTC string with second precision,
flooring any partial second: 2026-10-13T09:30:00Z.
Instants before 1970 are formatted too, in the proleptic Gregorian
calendar. Years outside 0000 to 9999 use the expanded form with a sign,
such as -0001-12-31T23:59:59Z.
to_inspect : Utc -> Str
How Str.inspect renders an instant: Utc(2026-10-13T09:30:00Z).
is_eq : _
Compare two instants for equality (== and !=).
Whether the first instant is earlier than the second (<).
Whether the first instant is no later than the second (<=).
Whether the first instant is later than the second (>).
Whether the first instant is no earlier than the second (>=).
order_relative_to : Utc, Utc -> [Before, Same, After]
Order two instants, earliest first. This is what List.sort and
List.sort_by use.