code wiki / (root) / nx_iso8601.nx

nx_iso8601.nx

buildroot/runtime/nx_iso8601.nx

6752 B198 linesdepth 3pulls 3 transitivereach 8 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

iso8601.nx -- format + parse ISO 8601 date-time strings. The canonical machine-readable timestamp format: 2026-04-22T12:34:56Z 2026-04-22T12:34:56.123Z (milliseconds -- optional) Used by: JSON APIs (the convention), HTTP Last-Modified headers (RFC 7231 also accepts IMF-fixdate but ISO is simpler), file export headers, nishi-pages post dates, obligation deadlines, log timestamps. We support the "basic profile" of ISO 8601: YYYY-MM-DDTHH:MM:SS[.fff]Z (UTC only, 'Z' suffix) Longer time-offset variants (+01:00, etc.) are NOT produced; we always emit UTC. Parser accepts both 'Z' and an optional '+HH:MM' / '-HH:MM' offset that we convert to seconds. Composes civil_date.nx. Invariants: I1 Format output is exactly 20 bytes for seconds precision, 24 bytes for millisecond precision. I2 Parser rejects strings with unknown fields (e.g. week numbers) with ISO_ERR_FORMAT; we stay narrowly useful. I3 Round-trip exact for format(parse(s)) on strings we emit.

dependencies 2 imports · 8 importers

nx_syscalls.nx nx_civil_date.nx nx_iso8601.nx nx_atom_v1.nx nx_circuit_breaker.nx nx_dead_letter_queue.nx nx_rate_limiter.nx nx_retry_policy.nx nx_smoke_harness.nx nx_source_adapter.nx nx_synthetic_upstream.nx

imports: nx_syscalls.nxnx_civil_date.nx

imported by: nx_atom_v1.nxnx_circuit_breaker.nxnx_dead_letter_queue.nxnx_rate_limiter.nxnx_retry_policy.nxnx_smoke_harness.nxnx_source_adapter.nxnx_synthetic_upstream.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap iso_format_unix sys_mmap ↻ civil_from_unix cd_fdiv cd_fmod cd_fdiv ↻ iso_format iso_put_4d iso_put_2d iso_parse iso_parse_4d iso_parse_2d iso_parse_2d ↻ unix_from_civil cd_fdiv ↻ unix_from_civil ↻

structs

none

consts

36const ISO_MAGIC_3600: i64 = 3600
37const ISO_MAGIC_2026: i64 = 2026
39const ISO_ERR_FORMAT: i64 = -1
40const ISO_ERR_SHORT: i64 = -2

functions

43func iso_put_2d(out: *u8, off: i64, v: i64) -> i64
called by 1: iso_format
50func iso_put_4d(out: *u8, off: i64, v: i64) -> i64
called by 1: iso_format
60func iso_format(out: *u8, cap: i64, cd: *CivilDate) -> i64
79func iso_format_unix(out: *u8, cap: i64, unix_sec: i64) -> i64
87func iso_parse_2d(buf: *u8, off: i64) -> i64
98func iso_parse_4d(buf: *u8, off: i64) -> i64
called by 1: iso_parse calls 1: iso_parse_2d
109func iso_parse(buf: *u8, n: i64, unix_sec_out: *i64) -> i64
173func main() -> i64