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