Time.Frame

lib/Time/Frame.gob

Seconds counted in the two frames a time zone moves between. A zone's rules say when its transitions happen in UTC and what its clocks read at each, and the arithmetic that relates the two is where an hour goes missing, so the frames are separate types and an offset is the only way between them.

Both are whole seconds, which is all offsets and transitions are; a fraction of a second is the caller's to carry. Neither is bounded: a reading can be any date, and a zone file's transitions reach far past the years an Instant can hold.

type LocalSeconds : Ord

Seconds since 1970-01-01T00:00 on a wall clock, in no zone.

type UnixSeconds : Ord

Seconds since 1970-01-01T00:00Z, leap seconds not counted.

type Transition = Transition { at : UnixSeconds, before : Offset, after : Offset }

A change of a zone's offset: when it happens, and the offsets either side.

fun local : fun(DayNumber, Duration) -> LocalSeconds

The reading since after the start of d, its fraction of a second dropped. since may be negative or longer than a day, as a time zone rule's times can be.

fun day : fun(LocalSeconds) -> DayNumber
fun sinceMidnight : fun(LocalSeconds) -> Duration

The time since the start of the reading's day, under a day.

fun toLocal : fun(UnixSeconds, Offset) -> LocalSeconds

What a clock o from UTC reads at t, and back.

fun toUnix : fun(LocalSeconds, Offset) -> UnixSeconds
fun fromInstant : fun(Instant) -> UnixSeconds

The second i falls in, and the nanoseconds it is into it.

fun fraction : fun(Instant) -> Int
fun toInstant : fun(UnixSeconds, Int) -> Option Instant

The instant nanos into the second t, if an Instant can hold it.

fun fromUnixSeconds : fun(Int) -> UnixSeconds

A count of Unix seconds read from outside: a zone file's transition times.

fun year : fun(UnixSeconds) -> Int

The year t falls in, in UTC.