UnixTime

:= []

Read and manipulate POSIX wall-clock timestamps.

A timestamp is an instant represented relative to the Unix epoch. It does not contain a calendar, time zone, formatting policy, or leap-second model. Use a Roc package such as roc-gregorian for those pure computations.

now! : () => Timestamp

Read the current POSIX wall-clock timestamp.

Timestamp

UnixTime.Timestamp :: # (opaque)

A normalized POSIX timestamp.

nanosecond is always less than 1,000,000,000. Negative instants use floor-based seconds, so one nanosecond before the epoch is represented as { seconds: -1, nanosecond: 999_999_999 }.

from_parts : { seconds : I64, nanosecond : U32 } -> Try(Timestamp, [InvalidNanosecond])

Construct a normalized timestamp.

seconds_since_epoch : Timestamp -> I64

Return whole seconds since the Unix epoch, rounded toward negative infinity.

subsecond_nanoseconds : Timestamp -> U32

Return the normalized fractional nanoseconds within the timestamp's current second.