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