1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
//! TZif output: the in-memory [`TzifData`] model and the writer that serialises it to the
//! on-disk format described by [RFC 9636] / `tzfile(5)`.
//!
//! # File shape (RFC 9636 §3)
//!
//! A version-2+ TZif file is three parts back to back:
//!
//! 1. a **version-1 block** — a 44-byte header followed by a data block that uses 32-bit
//! transition times;
//! 2. a **version-2+ block** — an identical-shape header (same version byte) followed by a
//! data block that uses 64-bit transition times;
//! 3. a **footer** — `\n`, a POSIX `TZ` string describing behaviour after the last
//! transition, then `\n`.
//!
//! Modern `zic` (the "slim" default) emits the v1 block as a near-empty **stub**: zero
//! transitions and a single placeholder local-time-type with offset 0 and an empty
//! abbreviation. All real information lives in the v2+ block and the footer. We reproduce
//! that exactly (it is what we must byte-match), and we document it loudly because it is
//! surprising: a strictly v1-only reader gets UT for every zone. That is `zic`'s own
//! behaviour in slim mode, not ours.
//!
//! [RFC 9636]: https://www.rfc-editor.org/rfc/rfc9636
pub use Counts;
pub use ;
pub use write_bytes;
/// One local-time-type (`ttinfo`): a UT offset, a DST flag, and an abbreviation.
/// One transition: the UT instant at which `type_index` begins to apply.
/// The fully-resolved, ready-to-serialise contents of one zone's TZif file.
///
/// Invariants the writer relies on (and [`validate`] re-checks):
/// * `types` is non-empty;
/// * every `transitions[i].type_index` is a valid index into `types`;
/// * `transitions` is strictly increasing in `at`.
/// One emitted TZif leap-second record (RFC 9636 §3.2 array 5): the (already-adjusted) occurrence
/// instant and the cumulative correction at/after it.