1.\" $NetBSD: tzfile.5,v 1.10 2002/02/08 01:28:23 ross 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.Fd #include \*[Lt]tzfile.h\*[Gt] 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. Each is used as a transition time (as returned by 55.Xr time 3 ) 56at which the rules for computing local time change. 57Next come 58.Va tzh_timecnt 59one-byte values of type 60.Fa unsigned char ; 61each one tells which of the different types of 62.Dq local time 63types described in the file is associated with the same-indexed 64transition time. These values serve as indices into an array of 65.Fa ttinfo 66structures that appears next in the file; 67these structures are defined as follows: 68.Bd -literal 69struct ttinfo { 70 long tt_gmtoff; 71 int tt_isdst; 72 unsigned int tt_abbrind; 73}; 74.Ed 75Each structure is written as a four-byte value for 76.Va tt_gmtoff 77of type 78.Fa long , 79in a standard byte order, followed by a one-byte value for 80.Va tt_isdst 81and a one-byte value for 82.Va tt_abbrind . 83In each structure, 84.Va tt_gmtoff 85gives the number of seconds to be added to UTC, 86.Va tt_isdst 87tells whether 88.Va tm_isdst 89should be set by 90.Xr localtime 3 91and 92.Va tt_abbrind 93serves as an index into the array of time zone abbreviation characters 94that follow the 95.Va ttinfo 96structure(s) in the file. 97.Pp 98Then there are 99.Va 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 3 ) 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 110Then there are 111.Va 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 POSIX-style 116time zone environment variables. 117.Pp 118Finally there are 119.Va tzh_ttisgmtcnt 120UTC/local indicators, each stored as a one-byte value; 121they tell whether the transition times associated with local time types 122were specified as UTC or local time, 123and are used when a time zone file is used in handling POSIX-style 124time zone environment variables. 125.Pp 126.Xr localtime 3 127uses the first standard-time 128.Fa ttinfo 129structure in the file 130(or simply the first 131.Fa ttinfo 132structure in the absence of a standard-time structure) 133if either 134.Va tzh_timecnt 135is zero or the time argument is less than the first transition time recorded 136in the file. 137.Sh SEE ALSO 138.Xr ctime 3 , 139.Xr localtime 3 , 140.Xr time 3 141