1TZFILE(5) Linux Programmer's Manual TZFILE(5)
2
3
4
6 tzfile - timezone information
7
9 This page describes the structure of the timezone files used by
10 tzset(3). These files are typically found under one of the directories
11 /usr/lib/zoneinfo or /usr/share/zoneinfo.
12
13 Timezone information files begin with the magic characters "TZif" to
14 identify them as timezone information files, followed by a character
15 identifying the version of the file's format (as of 2005, either an
16 ASCII NUL ('\0') or a '2') followed by fifteen bytes containing zeros
17 reserved for future use, followed by six four-byte values of type long,
18 written in a "standard" byte order (the high-order byte of the value is
19 written first). These values are, in order:
20
21 tzh_ttisgmtcnt
22 The number of UTC/local indicators stored in the file.
23
24 tzh_ttisstdcnt
25 The number of standard/wall indicators stored in the file.
26
27 tzh_leapcnt
28 The number of leap seconds for which data is stored in the file.
29
30 tzh_timecnt
31 The number of "transition times" for which data is stored in the
32 file.
33
34 tzh_typecnt
35 The number of "local time types" for which data is stored in the
36 file (must not be zero).
37
38 tzh_charcnt
39 The number of characters of "timezone abbreviation strings"
40 stored in the file.
41
42 The above header is followed by tzh_timecnt four-byte values of type
43 long, sorted in ascending order. These values are written in "stan‐
44 dard" byte order. Each is used as a transition time (as returned by
45 time(2)) at which the rules for computing local time change. Next come
46 tzh_timecnt one-byte values of type unsigned char; each one tells which
47 of the different types of "local time" types described in the file is
48 associated with the same-indexed transition time. These values serve
49 as indices into an array of ttinfo structures (with tzh_typecnt
50 entries) that appear next in the file; these structures are defined as
51 follows:
52
53 struct ttinfo {
54 long tt_gmtoff;
55 int tt_isdst;
56 unsigned int tt_abbrind;
57 };
58
59 Each structure is written as a four-byte value for tt_gmtoff of type
60 long, in a standard byte order, followed by a one-byte value for
61 tt_isdst and a one-byte value for tt_abbrind. In each structure,
62 tt_gmtoff gives the number of seconds to be added to UTC, tt_isdst
63 tells whether tm_isdst should be set by localtime(3), and tt_abbrind
64 serves as an index into the array of timezone abbreviation characters
65 that follow the ttinfo structure(s) in the file.
66
67 Then there are tzh_leapcnt pairs of four-byte values, written in stan‐
68 dard byte order; the first value of each pair gives the time (as
69 returned by time(2)) at which a leap second occurs; the second gives
70 the total number of leap seconds to be applied after the given time.
71 The pairs of values are sorted in ascending order by time.
72
73 Then there are tzh_ttisstdcnt standard/wall indicators, each stored as
74 a one-byte value; they tell whether the transition times associated
75 with local time types were specified as standard time or wall clock
76 time, and are used when a timezone file is used in handling POSIX-style
77 timezone environment variables.
78
79 Finally, there are tzh_ttisgmtcnt UTC/local indicators, each stored as
80 a one-byte value; they tell whether the transition times associated
81 with local time types were specified as UTC or local time, and are used
82 when a timezone file is used in handling POSIX-style timezone environ‐
83 ment variables.
84
85 localtime(3) uses the first standard-time ttinfo structure in the file
86 (or simply the first ttinfo structure in the absence of a standard-time
87 structure) if either tzh_timecnt is zero or the time argument is less
88 than the first transition time recorded in the file.
89
90 For version-2-format timezone files, the above header and data is fol‐
91 lowed by a second header and data, identical in format except that
92 eight bytes are used for each transition time or leap-second time.
93 After the second header and data comes a newline-enclosed, POSIX-TZ-
94 environment-variable-style string for use in handling instants after
95 the last transition time stored in the file (with nothing between the
96 newlines if there is no POSIX representation for such instants).
97
99 ctime(3), tzset(3), tzselect(8),
100
101 timezone/tzfile.h in the glibc source tree
102
104 This page is part of release 3.53 of the Linux man-pages project. A
105 description of the project, and information about reporting bugs, can
106 be found at http://www.kernel.org/doc/man-pages/.
107
108
109
110 2012-05-04 TZFILE(5)