Import yp binaries from NetBSD.
[unix-history] / share / zoneinfo / tzfile.5
CommitLineData
15637ed4
RG
1.\" Copyright (c) 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Arthur David Olson of the National Cancer Institute.
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in the
16.\" documentation and/or other materials provided with the distribution.
17.\" 3. All advertising materials mentioning features or use of this software
18.\" must display the following acknowledgement:
19.\" This product includes software developed by the University of
20.\" California, Berkeley and its contributors.
21.\" 4. Neither the name of the University nor the names of its contributors
22.\" may be used to endorse or promote products derived from this software
23.\" without specific prior written permission.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35.\" SUCH DAMAGE.
36.\"
37.\" @(#)tzfile.5 5.3 (Berkeley) 5/10/91
38.\"
39.Dd May 10, 1991
40.Dt TZFILE 5
41.Sh NAME
42.Nm tzfile
43.Nd time zone information
44.Sh SYNOPSIS
45.Fd #include <tzfile.h>
46.Sh DESCRIPTION
47The time zone information files used by
48.Xr tzset 3
49begin with bytes reserved for future use,
50followed by four four-byte values of type
51.Em long ,
52written in a ``standard'' byte order
53(the high-order byte of the value is written first).
54These values are,
55in order:
56.Bl -tag -width tzh_ttisstdcnt
57.It Fa tzh_ttisstdcnt
58The number of standard/wall indicators stored in the file.
59.It Fa tzh_leapcnt
60The number of leap seconds for which data is stored in the file.
61.It Fa tzh_timecnt
62The number of "transition times" for which data is stored
63in the file.
64.It Fa tzh_typecnt
65The number of "local time types" for which data is stored
66in the file (must not be zero).
67.It Fa tzh_charcnt
68The number of characters of "time zone abbreviation strings"
69stored in the file.
70.El
71.Pp
72The above header is followed by
73.Fa tzh_timecnt
74four-byte values of type
75.Em long ,
76sorted in ascending order.
77These values are written in ``standard'' byte order.
78Each is used as a transition time (as returned by
79.Xr time 2 )
80at which the rules for computing local time change.
81Next come
82.Fa tzh_timecnt
83one-byte values of type
84.Fa unsigned char ;
85each one tells which of the different types of ``local time'' types
86described in the file is associated with the same-indexed transition time.
87These values serve as indices into an array of
88.Fa ttinfo
89structures that appears next in the file;
90these structures are defined as follows:
91.Bd -literal -offset indent
92struct ttinfo {
93 long tt_gmtoff;
94 int tt_isdst;
95 unsigned int tt_abbrind;
96};
97.Ed
98.Pp
99Each structure is written as a four-byte value for
100.Fa tt_gmtoff
101of type
102.Em long ,
103in a standard byte order, followed by a one-byte value for
104.Fa tt_isdst
105and a one-byte value for
106.Fa tt_abbrind .
107In each structure,
108.Fa tt_gmtoff
109gives the number of seconds to be added to GMT,
110.Fa tt_isdst
111tells whether
112.Fa tm_isdst
113should be set by
114.Xr localtime 3
115and
116.Fa tt_abbrind
117serves as an index into the array of time zone abbreviation characters
118that follow the
119.Fa ttinfo
120structure(s) in the file.
121.Pp
122Then there are
123.Fa tzh_leapcnt
124pairs of four-byte values, written in standard byte order;
125the first value of each pair gives the time
126(as returned by
127.Xr time 2 )
128at which a leap second occurs;
129the second gives the
130.Em total
131number of leap seconds to be applied after the given time.
132The pairs of values are sorted in ascending order by time.
133.Pp
134Finally there are
135.Fa tzh_ttisstdcnt
136standard/wall indicators, each stored as a one-byte value;
137they tell whether the transition times associated with local time types
138were specified as standard time or wall clock time,
139and are used when a time zone file is used in handling
140.Tn POSIX Ns -style
141time zone environment variables.
142.Pp
143.Fa Localtime
144uses the first standard-time
145.Fa ttinfo
146structure in the file
147(or simply the first
148.Fa ttinfo
149structure in the absence of a standard-time structure)
150if either
151.Fa tzh_timecnt
152is zero or the time argument is less than the first transition time recorded
153in the file.
154.Sh SEE ALSO
155.Xr ctime 3
156.Sh HISTORY
157The
158.Nm tzfile
159file format appeared in
160.Bx 4.3 tahoe.