Compatibility¶
Time zone data source¶
FIND-TIME-ZONE reads the compiled IANA time zone database (TZif, RFC
8536) from disk: first $TZDIR/<name>, then /usr/share/zoneinfo/<name>.
TIME-ZONE-DATABASE-VERSION reads an explicit :TZDIR root only; otherwise
it reads $TZDIR and then /usr/share/zoneinfo. It reads each root's
+VERSION first and accepts it only when it is exactly a YYYYx IANA release.
Otherwise it reads tzdata.zi and returns the leading YYYYx token from its
first # version <release> comment, discarding suffixes such as -rearguard.
It returns NIL rather than signaling when the metadata is missing, unreadable,
overlong, or malformed.
It does not bundle a copy of the database, so:
- The library adds no ASDF dependency, but its correctness depends on
whatever
tzdatais installed on the host -- the same trade-off Python'szoneinfomodule makes by default. - Under Nix, point
TZDIRat nixpkgs'tzdatapackage ("${pkgs.tzdata}/share/zoneinfo") for a build that does not depend on the host's copy; this repository's ownflake.nixdoes exactly that fornix flake check. - Zone names are validated to reject absolute paths and
..components before touching the filesystem, so a caller cannot useFIND-TIME-ZONEto read arbitrary files. - TZif headers, data blocks, and POSIX footer strings are structurally
validated before allocating tables or dereferencing their indices. Truncated,
internally inconsistent, or invalid POSIX-rule files signal
MALFORMED-TZIFrather than leaking implementation-specific parsing or array-bound errors.
Explicit transitions vs. the POSIX-TZ footer¶
A TZif v2/v3 file has two parts: an explicit table of transition instants
(which real zic-generated files extend many years into the future -- as
of this writing, typically to around 2037) and a POSIX-TZ-style rule string
describing behavior after the last explicit transition.
OFFSET-FOR-INSTANTuses the POSIX-TZ rule correctly for any instant beyond the table, including far-future dates.- All POSIX-TZ date rule forms are parsed:
Mm.w.d[/time](week/weekday of month),Jn[/time](1--365, excluding February 29), andn[/time](0--365, including February 29). Transition times accept a sign and up to 167 hours, so a rule may cross a day or year boundary. A time with no suffix (orw) is wall time;sis standard time andu,g, andzare UTC.POSSIBLE-OFFSETS-FOR-LOCAL-DATE-TIMEandRESOLVE-LOCAL-DATE-TIMEderive these yearly footer transitions, so far-future local gaps and overlaps are detected just like explicit TZif transitions. - The footer must be fully consumed and contain valid abbreviations, offsets, and transition rules; malformed external zone data is rejected rather than being silently interpreted with partial rules.
What is not modeled¶
- Leap seconds.
LOCAL-TIME'sSECONDfield is always 0-59, matching java.time, Temporal, Gotime, and Rust'stime/chrono. - Non-Gregorian calendars.
LOCAL-DATEis proleptic Gregorian only, extended backward with no adjustment for the Julian calendar or any regional switchover date. - Locale-sensitive text.
DATE-TIME-FORMATTERships English:ENand Japanese:JAlocales.MAKE-DATE-TIME-LOCALEcan supply other translated month names, weekday names, and AM/PM text forMMM/MMMM,EEE/EEEE, anda; localized numerals are not supported. The 12-hourhfield requiresa;aalso validates the existing 24-hourHfield when both are present.