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