xref: /original-bsd/share/zoneinfo/tzfile.5 (revision c3e32dec)
1.\" Copyright (c) 1991, 1993
2.\"	The Regents of the University of California.  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.\" %sccs.include.redist.roff%
10.\"
11.\"	@(#)tzfile.5	8.1 (Berkeley) 06/08/93
12.\"
13.Dd
14.Dt TZFILE 5
15.Os
16.Sh NAME
17.Nm tzfile
18.Nd time zone information
19.Sh SYNOPSIS
20.Fd #include <tzfile.h>
21.Sh DESCRIPTION
22The time zone information files used by
23.Xr tzset 3
24begin with bytes reserved for future use,
25followed by four four-byte values of type
26.Em long ,
27written in a ``standard'' byte order
28(the high-order byte of the value is written first).
29These values are,
30in order:
31.Bl -tag -width tzh_ttisstdcnt
32.It Fa tzh_ttisstdcnt
33The number of standard/wall indicators stored in the file.
34.It Fa tzh_leapcnt
35The number of leap seconds for which data is stored in the file.
36.It Fa tzh_timecnt
37The number of "transition times" for which data is stored
38in the file.
39.It Fa tzh_typecnt
40The number of "local time types" for which data is stored
41in the file (must not be zero).
42.It Fa tzh_charcnt
43The number of characters of "time zone abbreviation strings"
44stored in the file.
45.El
46.Pp
47The above header is followed by
48.Fa tzh_timecnt
49four-byte values of type
50.Em long ,
51sorted in ascending order.
52These values are written in ``standard'' byte order.
53Each is used as a transition time (as returned by
54.Xr time 2 )
55at which the rules for computing local time change.
56Next come
57.Fa tzh_timecnt
58one-byte values of type
59.Fa unsigned char ;
60each one tells which of the different types of ``local time'' types
61described in the file is associated with the same-indexed transition time.
62These values serve as indices into an array of
63.Fa ttinfo
64structures that appears next in the file;
65these structures are defined as follows:
66.Bd -literal -offset indent
67struct ttinfo {
68	long	tt_gmtoff;
69	int	tt_isdst;
70	unsigned int	tt_abbrind;
71};
72.Ed
73.Pp
74Each structure is written as a four-byte value for
75.Fa tt_gmtoff
76of type
77.Em long ,
78in a standard byte order, followed by a one-byte value for
79.Fa tt_isdst
80and a one-byte value for
81.Fa tt_abbrind .
82In each structure,
83.Fa tt_gmtoff
84gives the number of seconds to be added to
85.Tn GMT ,
86.Fa tt_isdst
87tells whether
88.Fa tm_isdst
89should be set by
90.Xr localtime 3
91and
92.Fa tt_abbrind
93serves as an index into the array of time zone abbreviation characters
94that follow the
95.Fa ttinfo
96structure(s) in the file.
97.Pp
98Then there are
99.Fa tzh_leapcnt
100pairs of four-byte values, written in standard byte order;
101the first value of each pair gives the time
102(as returned by
103.Xr time 2 )
104at which a leap second occurs;
105the second gives the
106.Em total
107number of leap seconds to be applied after the given time.
108The pairs of values are sorted in ascending order by time.
109.Pp
110Finally there are
111.Fa tzh_ttisstdcnt
112standard/wall indicators, each stored as a one-byte value;
113they tell whether the transition times associated with local time types
114were specified as standard time or wall clock time,
115and are used when a time zone file is used in handling
116.Tn POSIX Ns -style
117time zone environment variables.
118.Pp
119.Fa Localtime
120uses the first standard-time
121.Fa ttinfo
122structure in the file
123(or simply the first
124.Fa ttinfo
125structure in the absence of a standard-time structure)
126if either
127.Fa tzh_timecnt
128is zero or the time argument is less than the first transition time recorded
129in the file.
130.Sh SEE ALSO
131.Xr ctime 3
132.Sh HISTORY
133The
134.Nm tzfile
135file format appeared in
136.Bx 4.3 tahoe.
137