1TZFILE(5) File Formats Manual TZFILE(5)
2
3
4
6 tzfile - time zone information
7
9 #include <tzfile.h>
10
12 The time zone information files used by tzset(3) begin with the magic
13 characters "TZif" to identify then as time zone information files, fol‐
14 lowed by sixteen bytes reserved for future use, followed by six four-
15 byte values of type long, written in a ``standard'' byte order (the
16 high-order byte of the value is written first). These values are, in
17 order:
18
19 tzh_ttisgmtcnt
20 The number of UTC/local indicators stored in the file.
21
22 tzh_ttisstdcnt
23 The number of standard/wall indicators stored in the file.
24
25 tzh_leapcnt
26 The number of leap seconds for which data is stored in the file.
27
28 tzh_timecnt
29 The number of "transition times" for which data is stored in the
30 file.
31
32 tzh_typecnt
33 The number of "local time types" for which data is stored in the
34 file (must not be zero).
35
36 tzh_charcnt
37 The number of characters of "time zone abbreviation strings"
38 stored in the file.
39
40 The above header is followed by tzh_timecnt four-byte values of type
41 long, sorted in ascending order. These values are written in ``stan‐
42 dard'' byte order. Each is used as a transition time (as returned by
43 time(2)) at which the rules for computing local time change. Next come
44 tzh_timecnt one-byte values of type unsigned char; each one tells which
45 of the different types of ``local time'' types described in the file is
46 associated with the same-indexed transition time. These values serve
47 as indices into an array of ttinfo structures that appears next in the
48 file; these structures are defined as follows:
49
50 struct ttinfo {
51 long tt_gmtoff;
52 int tt_isdst;
53 unsigned int tt_abbrind;
54 };
55
56 Each structure is written as a four-byte value for tt_gmtoff of type
57 long, in a standard byte order, followed by a one-byte value for
58 tt_isdst and a one-byte value for tt_abbrind. In each structure,
59 tt_gmtoff gives the number of seconds to be added to UTC, tt_isdst
60 tells whether tm_isdst should be set by localtime(3), and tt_abbrind
61 serves as an index into the array of time zone abbreviation characters
62 that follow the ttinfo structure(s) in the file.
63
64 Then there are tzh_leapcnt pairs of four-byte values, written in stan‐
65 dard byte order; the first value of each pair gives the time (as
66 returned by time(2)) at which a leap second occurs; the second gives
67 the total number of leap seconds to be applied after the given time.
68 The pairs of values are sorted in ascending order by time.
69
70 Then there are tzh_ttisstdcnt standard/wall indicators, each stored as
71 a one-byte value; they tell whether the transition times associated
72 with local time types were specified as standard time or wall clock
73 time, and are used when a time zone file is used in handling POSIX-
74 style time zone environment variables.
75
76 Finally, there are tzh_ttisgmtcnt UTC/local indicators, each stored as
77 a one-byte value; they tell whether the transition times associated
78 with local time types were specified as UTC or local time, and are used
79 when a time zone file is used in handling POSIX-style time zone envi‐
80 ronment variables.
81
82 Localtime uses the first standard-time ttinfo structure in the file (or
83 simply the first ttinfo structure in the absence of a standard-time
84 structure) if either tzh_timecnt is zero or the time argument is less
85 than the first transition time recorded in the file.
86
87
88
89 TZFILE(5)