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 timezone abbreviation strings stored in
45                the file.
46
47       The  above  header  is  followed by the following fields, whose lengths
48       vary 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 tells which of
56         the different types of local time types  described  in  the  file  is
57         associated  with the time period starting with the same-indexed tran‐
58         sition time.  These values serve as indices into the next field.
59
60       * tzh_typecnt ttinfo entries, each defined as follows:
61
62           struct ttinfo {
63               int32_t       tt_gmtoff;
64               unsigned char tt_isdst;
65               unsigned char tt_abbrind;
66           };
67
68       Each structure is written as  a  four-byte  signed  integer  value  for
69       tt_gmtoff,  in  a standard byte order, followed by a one-byte value for
70       tt_isdst and a one-byte  value  for  tt_abbrind.   In  each  structure,
71       tt_gmtoff gives the number of seconds to be added to UT, tt_isdst tells
72       whether tm_isdst should be set by localtime(3) and tt_abbrind serves as
73       an  index into the array of timezone abbreviation bytes that follow the
74       ttinfo structure(s) in the file.
75
76       *      tzh_leapcnt pairs of four-byte values, written in standard  byte
77              order;  the  first value of each pair gives the nonnegative time
78              (as returned by time(2)) at which a leap second occurs; the sec‐
79              ond  gives the total number of leap seconds to be applied during
80              the time period starting at the given time.  The pairs of values
81              are  sorted  in ascending order by time.  Each transition is for
82              one leap second, either positive or negative; transitions always
83              separated by at least 28 days minus 1 second.
84
85       *      tzh_ttisstdcnt  standard/wall  indicators, each stored as a one-
86              byte value; they tell whether the  transition  times  associated
87              with  local  time  types were specified as standard time or wall
88              clock time, and are used when a timezone file is  used  in  han‐
89              dling POSIX-style timezone environment variables.
90
91       *      tzh_ttisgmtcnt  UT/local  indicators,  each stored as a one-byte
92              value; they tell whether the transition  times  associated  with
93              local  time  types  were  specified as UT or local time, and are
94              used when a timezone file is used in handling POSIX-style  time‐
95              zone environment variables.
96
97       The localtime(3) function uses the first standard-time ttinfo structure
98       in the file (or simply the first ttinfo structure in the absence  of  a
99       standard-time  structure)  if  either  tzh_timecnt  is zero or the time
100       argument is less than the first transition time recorded in the file.
101
102   Version 2 format
103       For version-2-format timezone files, the above header and data are fol‐
104       lowed  by  a  second  header  and data, identical in format except that
105       eight bytes are used for each transition  time  or  leap  second  time.
106       (Leap  second  counts  remain four bytes.)  After the second header and
107       data  comes  a  newline-enclosed,   POSIX-TZ-environment-variable-style
108       string  for  use  in  handling  instants after the last transition time
109       stored in the file (with nothing between the newlines if  there  is  no
110       POSIX  representation  for such instants).  The POSIX-style string must
111       agree with the local time type after both data's last transition times;
112       for  example,  given  the  string “WET0WEST,M3.5.0,M10.5.0/3” then if a
113       last transition time is in July, the transition's local time type  must
114       specify a daylight-saving time abbreviated “WEST” that is one hour east
115       of UT.
116
117   Version 3 format
118       For version-3-format timezone files, the POSIX-TZ-style string may  use
119       two   minor  extensions  to  the  POSIX  TZ  format,  as  described  in
120       newtzset(3).  First, the hours part of  its  transition  times  may  be
121       signed  and  range  from -167 through 167 instead of the POSIX-required
122       unsigned values from 0 through 24.  Second, DST is in effect  all  year
123       if  it starts January 1 at 00:00 and ends December 31 at 24:00 plus the
124       difference between daylight saving and standard time.
125
126       Future changes to the format may append more data.
127

SEE ALSO

129       time(2), localtime(3), tzset(3), tzselect(8), zdump(8), zic(8)
130

COLOPHON

132       This page is part of release 4.16 of the Linux  man-pages  project.   A
133       description  of  the project, information about reporting bugs, and the
134       latest    version    of    this    page,    can     be     found     at
135       https://www.kernel.org/doc/man-pages/.
136
137
138
139                                  2017-08-04                         TZFILE(5)
Impressum