1 TZFILE(5) File Formats Manual TZFILE(5)
4 tzfile - time zone information
7 The time zone information files used by tzset(3) begin with the magic
8 characters "TZif" to identify them as time zone information files,
9 followed by a character identifying the version of the file's format
10 (as of 2013, either an ASCII NUL, or '2', or '3') followed by fifteen
11 bytes containing zeroes reserved for future use, followed by six four-
12 byte integer values written in a standard byte order (the high-order
13 byte of the value is written first). These values are, in order:
16 The number of UT/local indicators stored in the file.
19 The number of standard/wall indicators stored in the file.
22 The number of leap seconds for which data entries are stored in
26 The number of transition times for which data entries are stored
30 The number of local time types for which data entries are stored
31 in the file (must not be zero).
34 The number of characters of time zone abbreviation strings
37 The above header is followed by tzh_timecnt four-byte signed integer
38 values sorted in ascending order. These values are written in standard
39 byte order. Each is used as a transition time (as returned by time(2))
40 at which the rules for computing local time change. Next come
41 tzh_timecnt one-byte unsigned integer values; each one tells which of
42 the different types of local time types described in the file is
43 associated with the time period starting with the same-indexed
44 transition time. These values serve as indices into an array of ttinfo
45 structures (with tzh_typecnt entries) that appears next in the file;
46 these structures are defined as follows:
50 unsigned char tt_isdst;
51 unsigned char tt_abbrind;
54 Each structure is written as a four-byte signed integer value for
55 tt_gmtoff, in a standard byte order, followed by a one-byte value for
56 tt_isdst and a one-byte value for tt_abbrind. In each structure,
57 tt_gmtoff gives the number of seconds to be added to UT, tt_isdst tells
58 whether tm_isdst should be set by localtime (3) and tt_abbrind serves
59 as an index into the array of time zone abbreviation characters that
60 follow the ttinfo structure(s) in the file.
62 Then there are tzh_leapcnt pairs of four-byte values, written in
63 standard byte order; the first value of each pair gives the time (as
64 returned by time(2)) at which a leap second occurs; the second gives
65 the total number of leap seconds to be applied during the time period
66 starting at the given time. The pairs of values are sorted in
67 ascending order by time.
69 Then there are tzh_ttisstdcnt standard/wall indicators, each stored as
70 a one-byte value; they tell whether the transition times associated
71 with local time types were specified as standard time or wall clock
72 time, and are used when a time zone file is used in handling POSIX-
73 style time zone environment variables.
75 Finally there are tzh_ttisgmtcnt UT/local indicators, each stored as a
76 one-byte value; they tell whether the transition times associated with
77 local time types were specified as UT or local time, and are used when
78 a time zone file is used in handling POSIX-style time zone environment
81 Localtime uses the first standard-time ttinfo structure in the file (or
82 simply the first ttinfo structure in the absence of a standard-time
83 structure) if either tzh_timecnt is zero or the time argument is less
84 than the first transition time recorded in the file.
86 For version-2-format time zone files, the above header and data are
87 followed by a second header and data, identical in format except that
88 eight bytes are used for each transition time or leap second time.
89 After the second header and data comes a newline-enclosed, POSIX-TZ-
90 environment-variable-style string for use in handling instants after
91 the last transition time stored in the file (with nothing between the
92 newlines if there is no POSIX representation for such instants). The
93 POSIX-style string must must agree with the local time type after both
94 data's last transition times; for example, given the string
95 "WET0WEST,M3.5.0,M10.5.0/3" then if a last transition time is in July,
96 the transition's local time type must specify a daylight-saving time
97 abbreviated "WEST" that is one hour east of UT.
99 For version-3-format time zone files, the POSIX-TZ-style string may use
100 two minor extensions to the POSIX TZ format, as described in
101 newtzset(3). First, the hours part of its transition times may be
102 signed and range from -167 through 167 instead of the POSIX-required
103 unsigned values from 0 through 24. Second, DST is in effect all year
104 if it starts January 1 at 00:00 and ends December 31 at 24:00 plus the
105 difference between daylight saving and standard time.
107 Future changes to the format may append more data.
110 newctime(3), newtzset(3), zdump(8), zic(8)