Skip to main content

zdump_rs/
lib.rs

1//! zdump-rs — a bounded, independent Rust TZif **witness** companion to zic-rs.
2//!
3//! `zic-rs` is the compiler (tzdb source → TZif). `zdump-rs` is the inspection companion: it reads TZif
4//! and renders what it *means* (offset / is_dst / abbreviation) at explicit instants, as deterministic
5//! JSON witness rows, so the evidence court has an **independent second reader** to cross-check against
6//! reference `zdump`.
7//!
8//! ## Scope
9//! Phase 1 (`T23.zdump-witness.1`):
10//! - read TZif v1/v2/v3/v4 (independent reader; no shared code with zic-rs)
11//! - evaluate offset/is_dst/abbreviation at explicit UTC instants
12//! - emit deterministic JSON witness rows
13//!
14//! Phase 2 (`T23.zdump-witness.2`):
15//! - **interpret the POSIX footer** so instants beyond the last explicit transition are *projected*
16//!   (offset/is_dst/abbreviation), matching reference `zdump` far-future — `posix` module
17//! - **transition listing** over a year window (the `zdump -v` analog) — `Tzif::transitions_in`
18//! - **expose the leap-second table** in the listing
19//!
20//! Phase 3 (`T23.zdump-witness.3`):
21//! - **named-zone resolution** via `$TZDIR`/`--tzdir` (use `America/New_York`, not just a path) — `zone`
22//! - **`-c lo,hi`** year-cut (the `zdump -c` flag) on the transition listing
23//! - **leap-second `23:59:60` rendering** for `right/` zones (TAI wall rendering near leaps) — `leap`
24//!
25//! ## Explicit NON-claims (guarded as hard as the capability)
26//! - NOT a full `zdump` replacement · NOT exact stdout/stderr parity · NOT all flags
27//! - NOT locale behaviour · NOT a replacement oracle (reference `zdump` stays the oracle)
28//! - NOT civil-time truth
29//! - does NOT apply leap-second corrections to the displayed wall time for `right/` zones (the per-type
30//!   offset/is_dst/abbreviation are reported correctly; the TAI-scale wall rendering near leaps is a
31//!   tracked Phase-3 refinement)
32
33#![forbid(unsafe_code)]
34
35pub mod civil;
36pub mod leap;
37pub mod posix;
38pub mod tzif;
39pub mod witness;
40pub mod zone;
41
42pub use tzif::{parse, Observation, TransitionRow, Tzif};
43pub use witness::WitnessRow;
44
45/// The fixed, declared probe-instant set (`--probe-default`): pre-epoch, the 32-bit `time_t` floor/ceiling,
46/// a few civil years around the admitted 2026b release, and a far-future (footer-governed) point. Shared by
47/// the CLI and the golden test so they cannot drift.
48pub const PROBE_DEFAULT: &[&str] = &[
49    "1901-12-13T20:45:52Z",
50    "1933-01-01T00:00:00Z",
51    "1970-01-01T00:00:00Z",
52    "2000-06-01T00:00:00Z",
53    "2026-01-01T00:00:00Z",
54    "2026-07-01T00:00:00Z",
55    "2038-01-19T03:14:07Z",
56    "2100-01-01T00:00:00Z",
57    "2200-07-01T12:00:00Z",
58];