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