OSDN Git Service

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