OSDN Git Service

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