OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man5 / tzfile.5
1 .\" %%%LICENSE_START(PUBLIC_DOMAIN)
2 .\" This file is in the public domain, so clarified as of
3 .\" 1996-06-05 by Arthur David Olson <arthur_david_olson@nih.gov>.
4 .\" %%%LICENSE_END
5 .\"
6 .\" @(#)tzfile.5        7.11
7 .\"
8 .TH TZFILE 5 2012-05-04 "" "Linux Programmer's Manual"
9 .SH NAME
10 tzfile \- timezone information
11 .SH DESCRIPTION
12 This page describes the structure of the timezone files used by
13 .BR tzset (3).
14 These files are typically found under one of the directories
15 .IR /usr/lib/zoneinfo
16 or
17 .IR /usr/share/zoneinfo .
18
19 Timezone information files
20 begin with the magic characters "TZif" to identify them as
21 timezone information files,
22 followed by a character identifying the version of the file's format
23 (as of 2005, either an ASCII NUL (\(aq\\0\(aq) or a \(aq2\(aq)
24 followed by fifteen bytes containing zeros reserved for future use,
25 followed by six four-byte values of type
26 .IR long ,
27 written in a "standard" byte order
28 (the high-order byte of the value is written first).
29 These values are,
30 in order:
31 .TP
32 .I tzh_ttisgmtcnt
33 The number of UTC/local indicators stored in the file.
34 .TP
35 .I tzh_ttisstdcnt
36 The number of standard/wall indicators stored in the file.
37 .TP
38 .I tzh_leapcnt
39 The number of leap seconds for which data is stored in the file.
40 .TP
41 .I tzh_timecnt
42 The number of "transition times" for which data is stored
43 in the file.
44 .TP
45 .I tzh_typecnt
46 The number of "local time types" for which data is stored
47 in the file (must not be zero).
48 .TP
49 .I tzh_charcnt
50 The number of characters of "timezone abbreviation strings"
51 stored in the file.
52 .PP
53 The above header is followed by
54 .I tzh_timecnt
55 four-byte values of type
56 .IR long ,
57 sorted in ascending order.
58 These values are written in "standard" byte order.
59 Each is used as a transition time (as returned by
60 .BR time (2))
61 at which the rules for computing local time change.
62 Next come
63 .I tzh_timecnt
64 one-byte values of type
65 .IR "unsigned char" ;
66 each one tells which of the different types of "local time" types
67 described in the file is associated with the same-indexed transition time.
68 These values serve as indices into an array of
69 .I ttinfo
70 structures (with
71 .I tzh_typecnt
72 entries) that appear next in the file;
73 these structures are defined as follows:
74 .in +4n
75 .sp
76 .nf
77 struct ttinfo {
78     long         tt_gmtoff;
79     int          tt_isdst;
80     unsigned int tt_abbrind;
81 };
82 .in
83 .fi
84 .sp
85 Each structure is written as a four-byte value for
86 .I tt_gmtoff
87 of type
88 .IR long ,
89 in a standard byte order, followed by a one-byte value for
90 .I tt_isdst
91 and a one-byte value for
92 .IR tt_abbrind .
93 In each structure,
94 .I tt_gmtoff
95 gives the number of seconds to be added to UTC,
96 .I tt_isdst
97 tells whether
98 .I tm_isdst
99 should be set by
100 .BR localtime (3),
101 and
102 .I tt_abbrind
103 serves as an index into the array of timezone abbreviation characters
104 that follow the
105 .I ttinfo
106 structure(s) in the file.
107 .PP
108 Then there are
109 .I tzh_leapcnt
110 pairs of four-byte values, written in standard byte order;
111 the first value of each pair gives the time
112 (as returned by
113 .BR time (2))
114 at which a leap second occurs;
115 the second gives the
116 .I total
117 number of leap seconds to be applied after the given time.
118 The pairs of values are sorted in ascending order by time.
119 .PP
120 Then there are
121 .I tzh_ttisstdcnt
122 standard/wall indicators, each stored as a one-byte value;
123 they tell whether the transition times associated with local time types
124 were specified as standard time or wall clock time,
125 and are used when a timezone file is used in handling POSIX-style
126 timezone environment variables.
127 .PP
128 Finally, there are
129 .I tzh_ttisgmtcnt
130 UTC/local indicators, each stored as a one-byte value;
131 they tell whether the transition times associated with local time types
132 were specified as UTC or local time,
133 and are used when a timezone file is used in handling POSIX-style
134 timezone environment variables.
135 .PP
136 .BR localtime (3)
137 uses the first standard-time
138 .I ttinfo
139 structure in the file
140 (or simply the first
141 .I ttinfo
142 structure in the absence of a standard-time structure)
143 if either
144 .I tzh_timecnt
145 is zero or the time argument is less than the first transition time recorded
146 in the file.
147 .PP
148 For version-2-format timezone files,
149 the above header and data is followed by a second header and data,
150 identical in format except that
151 eight bytes are used for each transition time or leap-second time.
152 After the second header and data comes a newline-enclosed,
153 POSIX-TZ-environment-variable-style string for use in handling instants
154 after the last transition time stored in the file
155 (with nothing between the newlines if there is no POSIX representation for
156 such instants).
157 .SH SEE ALSO
158 .BR ctime (3),
159 .BR tzset (3),
160 .BR tzselect (8),
161
162 .I timezone/tzfile.h
163 in the glibc source tree
164 .SH COLOPHON
165 This page is part of release 3.79 of the Linux
166 .I man-pages
167 project.
168 A description of the project,
169 information about reporting bugs,
170 and the latest version of this page,
171 can be found at
172 \%http://www.kernel.org/doc/man\-pages/.