Skip to main content

Module time

Module time 

Source
Expand description

Time formatting for display (spec §7 “Display conventions”).

Commit timestamps are stored as Unix seconds. iso8601 renders the stable --json form (2024-01-15T10:30:00Z); relative renders the human form as a single largest unit (just now, 5m ago, 3h ago, 2d ago, 4mo ago, 1y ago).

Functions§

iso8601
Formats Unix seconds as an ISO-8601 UTC string (YYYY-MM-DDTHH:MM:SSZ).
now_unix
The current time as Unix seconds (the reference for relative).
parse_iso8601
Parses an ISO-8601 timestamp (as produced by iso8601) back to Unix seconds, for computing relative display from the stored value.
relative
Renders the gap from then_unix to now_unix as a single largest unit. Times in the future (or under a minute old) render as just now.