Time.Instant

lib/Time/Instant.gob

A point on the global timeline, with no calendar and no time zone: when a log line was written or a file changed. It has no year or hour of its own; those depend on a zone.

Stored as nanoseconds since 1970-01-01T00:00Z, the count the system clock and file times use, which spans 1677-09-21 to 2262-04-11. Arithmetic past that panics, as Int arithmetic does. The calendar types have no such limit; it is the instant's alone.

Leap seconds are not counted: like the system clock, an instant treats every day as 86,400 seconds.

type Instant : Ord
fun now : fun() -> Instant

The system clock's reading. The clock can be set back or forward while a program runs, so two readings can go backwards: for telling the time, not for measuring how long something took or setting a limit on it, which is what a Stopwatch and a Deadline are for.

fun fromUnixNanos : fun(Int) -> Instant
fun unixNanos : fun(Instant) -> Int
fun after : fun(Instant, Duration) -> Instant
fun elapsed : fun(Instant, Instant) -> Duration

The time from from to to: negative if to is earlier.

fun parse : fun(String) -> Option Instant

RFC 3339: a date, T, a time, and a UTC offset, which is required. Text without one names a wall-clock reading, not an instant. None if the instant is outside the range above.

instance Show Instant

RFC 3339, in UTC: 2026-10-18T18:03:07.52Z.