add files fom from zcode2012e.tar.gz
[platform/upstream/tzdata.git] / tzfile.5
1 .TH TZFILE 5
2 .SH NAME
3 tzfile \- time zone information
4 .SH SYNOPSIS
5 .B
6 #include <tzfile.h>
7 .SH DESCRIPTION
8 The time zone information files used by
9 .IR tzset (3)
10 begin with the magic characters "TZif" to identify them as
11 time zone information files,
12 followed by a character identifying the version of the file's format
13 (as of 2005, either an ASCII NUL or a '2')
14 followed by fifteen bytes containing zeroes reserved for future use,
15 followed by six four-byte values of type
16 .BR long ,
17 written in a ``standard'' byte order
18 (the high-order byte of the value is written first).
19 These values are,
20 in order:
21 .TP
22 .I tzh_ttisgmtcnt
23 The number of UTC/local indicators stored in the file.
24 .TP
25 .I tzh_ttisstdcnt
26 The number of standard/wall indicators stored in the file.
27 .TP
28 .I tzh_leapcnt
29 The number of leap seconds for which data is stored in the file.
30 .TP
31 .I tzh_timecnt
32 The number of "transition times" for which data is stored
33 in the file.
34 .TP
35 .I tzh_typecnt
36 The number of "local time types" for which data is stored
37 in the file (must not be zero).
38 .TP
39 .I tzh_charcnt
40 The number of characters of "time zone abbreviation strings"
41 stored in the file.
42 .PP
43 The above header is followed by
44 .I tzh_timecnt
45 four-byte values of type
46 .BR long ,
47 sorted in ascending order.
48 These values are written in ``standard'' byte order.
49 Each is used as a transition time (as returned by
50 .IR time (2))
51 at which the rules for computing local time change.
52 Next come
53 .I tzh_timecnt
54 one-byte values of type
55 .BR "unsigned char" ;
56 each one tells which of the different types of ``local time'' types
57 described in the file is associated with the same-indexed transition time.
58 These values serve as indices into an array of
59 .I ttinfo
60 structures (with
61 .I tzh_typecnt
62 entries) that appears next in the file;
63 these structures are defined as follows:
64 .in +.5i
65 .sp
66 .nf
67 .ta .5i +\w'unsigned int\0\0'u
68 struct ttinfo {
69         long    tt_gmtoff;
70         int     tt_isdst;
71         unsigned int    tt_abbrind;
72 };
73 .in -.5i
74 .fi
75 .sp
76 Each structure is written as a four-byte value for
77 .I tt_gmtoff
78 of type
79 .BR long ,
80 in a standard byte order, followed by a one-byte value for
81 .I tt_isdst
82 and a one-byte value for
83 .IR tt_abbrind .
84 In each structure,
85 .I tt_gmtoff
86 gives the number of seconds to be added to UTC,
87 .I tt_isdst
88 tells whether
89 .I tm_isdst
90 should be set by
91 .I localtime (3)
92 and
93 .I tt_abbrind
94 serves as an index into the array of time zone abbreviation characters
95 that follow the
96 .I ttinfo
97 structure(s) in the file.
98 .PP
99 Then there are
100 .I tzh_leapcnt
101 pairs of four-byte values, written in standard byte order;
102 the first value of each pair gives the time
103 (as returned by
104 .IR time(2))
105 at which a leap second occurs;
106 the second gives the
107 .I total
108 number of leap seconds to be applied after the given time.
109 The pairs of values are sorted in ascending order by time.
110 .PP
111 Then there are
112 .I tzh_ttisstdcnt
113 standard/wall indicators, each stored as a one-byte value;
114 they tell whether the transition times associated with local time types
115 were specified as standard time or wall clock time,
116 and are used when a time zone file is used in handling POSIX-style
117 time zone environment variables.
118 .PP
119 Finally there are
120 .I tzh_ttisgmtcnt
121 UTC/local indicators, each stored as a one-byte value;
122 they tell whether the transition times associated with local time types
123 were specified as UTC or local time,
124 and are used when a time zone file is used in handling POSIX-style
125 time zone environment variables.
126 .PP
127 .I Localtime
128 uses the first standard-time
129 .I ttinfo
130 structure in the file
131 (or simply the first
132 .I ttinfo
133 structure in the absence of a standard-time structure)
134 if either
135 .I tzh_timecnt
136 is zero or the time argument is less than the first transition time recorded
137 in the file.
138 .PP
139 For version-2-format time zone files,
140 the above header and data is followed by a second header and data,
141 identical in format except that
142 eight bytes are used for each transition time or leap second time.
143 After the second header and data comes a newline-enclosed,
144 POSIX-TZ-environment-variable-style string for use in handling instants
145 after the last transition time stored in the file
146 (with nothing between the newlines if there is no POSIX representation for
147 such instants).
148 .SH SEE ALSO
149 newctime(3)
150 .\" This file is in the public domain, so clarified as of
151 .\" 1996-06-05 by Arthur David Olson.