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