1TZFILE(5)                  Linux Programmer's Manual                 TZFILE(5)
2
3
4

NAME

6       tzfile - timezone information
7

DESCRIPTION

9       The  timezone  information  files  used by tzset(3) are typically found
10       under a directory with a name like  /usr/share/zoneinfo.   These  files
11       begin with a 44-byte header containing the following fields:
12
13       * The  magic  four-byte  ASCII sequence “TZif” identifies the file as a
14         timezone information file.
15
16       * A byte identifying the version of the  file's  format  (as  of  2017,
17         either an ASCII NUL, or “2”, or “3”).
18
19       * Fifteen bytes containing zeros reserved for future use.
20
21       * Six  four-byte  integer  values written in a standard byte order (the
22         high-order byte of the value is written first).  These values are, in
23         order:
24
25         tzh_ttisgmtcnt
26                The number of UT/local indicators stored in the file.
27
28         tzh_ttisstdcnt
29                The number of standard/wall indicators stored in the file.
30
31         tzh_leapcnt
32                The  number  of leap seconds for which data entries are stored
33                in the file.
34
35         tzh_timecnt
36                The number of transition times  for  which  data  entries  are
37                stored in the file.
38
39         tzh_typecnt
40                The  number  of  local  time  types for which data entries are
41                stored in the file (must not be zero).
42
43         tzh_charcnt
44                The number of bytes of time zone abbreviation  strings  stored
45                in the file.
46
47       The  above  header  is  followed by the following fields, whose lengths
48       depend on the contents of the header:
49
50       * tzh_timecnt four-byte  signed  integer  values  sorted  in  ascending
51         order.   These  values  are  written in standard byte order.  Each is
52         used as a transition time (as returned by time(2)) at which the rules
53         for computing local time change.
54
55       * tzh_timecnt  one-byte  unsigned integer values; each one but the last
56         tells which of the different types of local time types  described  in
57         the  file  is associated with the time period starting with the same-
58         indexed transition time and continuing up to but  not  including  the
59         next  transition  time.  (The last time type is present only for con‐
60         sistency checking with the POSIX-style TZ  string  described  below.)
61         These values serve as indices into the next field.
62
63       * tzh_typecnt ttinfo entries, each defined as follows:
64
65              struct ttinfo {
66                   int32_t        tt_gmtoff;
67                   unsigned char  tt_isdst;
68                   unsigned char  tt_abbrind;
69              };
70
71         Each  structure  is  written  as a four-byte signed integer value for
72         tt_gmtoff, in a standard byte order, followed by a one-byte value for
73         tt_isdst  and  a  one-byte  value for tt_abbrind.  In each structure,
74         tt_gmtoff gives the number of seconds to be  added  to  UT,  tt_isdst
75         tells  whether  tm_isdst should be set by localtime(3) and tt_abbrind
76         serves as an index into the array of  time  zone  abbreviation  bytes
77         that follow the ttinfo structure(s) in the file.
78
79       * tzh_leapcnt  pairs  of  four-byte  values,  written  in standard byte
80         order; the first value of each pair gives the  nonnegative  time  (as
81         returned  by time(2)) at which a leap second occurs; the second gives
82         the total number of leap seconds to be applied during the time period
83         starting  at  the  given  time.   The  pairs  of values are sorted in
84         ascending order by time.  Each transition is  for  one  leap  second,
85         either positive or negative; transitions always separated by at least
86         28 days minus 1 second.
87
88       * tzh_ttisstdcnt standard/wall indicators, each stored  as  a  one-byte
89         value;  they  tell whether the transition times associated with local
90         time types were specified as standard time or wall  clock  time,  and
91         are  used  when a timezone file is used in handling POSIX-style time‐
92         zone environment variables.
93
94       * tzh_ttisgmtcnt UT/local indicators, each stored as a one-byte  value;
95         they  tell  whether  the  transition times associated with local time
96         types were specified as UT or local time, and are used when  a  time‐
97         zone  file is used in handling POSIX-style timezone environment vari‐
98         ables.
99
100       The localtime(3) function uses the first standard-time ttinfo structure
101       in  the  file (or simply the first ttinfo structure in the absence of a
102       standard-time structure) if either tzh_timecnt  is  zero  or  the  time
103       argument is less than the first transition time recorded in the file.
104
105   Version 2 format
106       For version-2-format timezone files, the above header and data are fol‐
107       lowed by a second header and data,  identical  in  format  except  that
108       eight  bytes  are  used  for  each transition time or leap second time.
109       (Leap second counts remain four bytes.)  After the  second  header  and
110       data   comes  a  newline-enclosed,  POSIX-TZ-environment-variable-style
111       string for use in handling instants  after  the  last  transition  time
112       stored  in the file or for all instants if the file has no transitions.
113       The POSIX-style TZ string is empty (i.e., nothing between the newlines)
114       if  there  is  no POSIX representation for such instants.  If nonempty,
115       the POSIX-style TZ string must agree with the local time type after the
116       last  transition  time  if present in the eight-byte data; for example,
117       given the string “WET0WEST,M3.5.0,M10.5.0/3” then if a last  transition
118       time  is  in July, the transition's local time type must specify a day‐
119       light-saving time abbreviated “WEST” that  is  one  hour  east  of  UT.
120       Also,  if  there  is at least one transition, time type 0 is associated
121       with the time period from the indefinite past up to but  not  including
122       the earliest transition time.
123
124   Version 3 format
125       For  version-3-format timezone files, the POSIX-TZ-style string may use
126       two  minor  extensions  to  the  POSIX  TZ  format,  as  described   in
127       newtzset(3).   First,  the  hours  part  of its transition times may be
128       signed and range from -167 through 167 instead  of  the  POSIX-required
129       unsigned  values  from 0 through 24.  Second, DST is in effect all year
130       if it starts January 1 at 00:00 and ends December 31 at 24:00 plus  the
131       difference between daylight saving and standard time.
132
133       Future changes to the format may append more data.
134

SEE ALSO

136       time(2), localtime(3), tzset(3), tzselect(8), zdump(8), zic(8)
137

COLOPHON

139       This  page  is  part of release 5.04 of the Linux man-pages project.  A
140       description of the project, information about reporting bugs,  and  the
141       latest     version     of     this    page,    can    be    found    at
142       https://www.kernel.org/doc/man-pages/.
143
144
145
146                                  2019-03-06                         TZFILE(5)
Impressum