1bc421551SDag-Erling Smørgrav /* Layout and location of TZif files. */ 2bc421551SDag-Erling Smørgrav 3bc421551SDag-Erling Smørgrav #ifndef TZFILE_H 4bc421551SDag-Erling Smørgrav #define TZFILE_H 5bc421551SDag-Erling Smørgrav 6bc421551SDag-Erling Smørgrav 7bc421551SDag-Erling Smørgrav /* 8bc421551SDag-Erling Smørgrav ** This file is in the public domain, so clarified as of 9bc421551SDag-Erling Smørgrav ** 1996-06-05 by Arthur David Olson. 10bc421551SDag-Erling Smørgrav ** 11bc421551SDag-Erling Smørgrav ** $FreeBSD$ 12bc421551SDag-Erling Smørgrav */ 13bc421551SDag-Erling Smørgrav 14bc421551SDag-Erling Smørgrav /* 15bc421551SDag-Erling Smørgrav ** This header is for use ONLY with the time conversion code. 16bc421551SDag-Erling Smørgrav ** There is no guarantee that it will remain unchanged, 17bc421551SDag-Erling Smørgrav ** or that it will remain at all. 18bc421551SDag-Erling Smørgrav ** Do NOT copy it to any system include directory. 19bc421551SDag-Erling Smørgrav ** Thank you! 20bc421551SDag-Erling Smørgrav */ 21bc421551SDag-Erling Smørgrav 22bc421551SDag-Erling Smørgrav /* 23bc421551SDag-Erling Smørgrav ** Information about time zone files. 24bc421551SDag-Erling Smørgrav */ 25bc421551SDag-Erling Smørgrav 26bc421551SDag-Erling Smørgrav #ifndef TZDEFRULES 27bc421551SDag-Erling Smørgrav # define TZDEFRULES "posixrules" 28bc421551SDag-Erling Smørgrav #endif /* !defined TZDEFRULES */ 29bc421551SDag-Erling Smørgrav 30bc421551SDag-Erling Smørgrav 31bc421551SDag-Erling Smørgrav /* See Internet RFC 8536 for more details about the following format. */ 32bc421551SDag-Erling Smørgrav 33bc421551SDag-Erling Smørgrav /* 34bc421551SDag-Erling Smørgrav ** Each file begins with. . . 35bc421551SDag-Erling Smørgrav */ 36bc421551SDag-Erling Smørgrav 37bc421551SDag-Erling Smørgrav #define TZ_MAGIC "TZif" 38bc421551SDag-Erling Smørgrav 39bc421551SDag-Erling Smørgrav struct tzhead { 40bc421551SDag-Erling Smørgrav char tzh_magic[4]; /* TZ_MAGIC */ 41bc421551SDag-Erling Smørgrav char tzh_version[1]; /* '\0' or '2'-'4' as of 2021 */ 42bc421551SDag-Erling Smørgrav char tzh_reserved[15]; /* reserved; must be zero */ 43bc421551SDag-Erling Smørgrav char tzh_ttisutcnt[4]; /* coded number of trans. time flags */ 44bc421551SDag-Erling Smørgrav char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ 45bc421551SDag-Erling Smørgrav char tzh_leapcnt[4]; /* coded number of leap seconds */ 46bc421551SDag-Erling Smørgrav char tzh_timecnt[4]; /* coded number of transition times */ 47bc421551SDag-Erling Smørgrav char tzh_typecnt[4]; /* coded number of local time types */ 48bc421551SDag-Erling Smørgrav char tzh_charcnt[4]; /* coded number of abbr. chars */ 49bc421551SDag-Erling Smørgrav }; 50bc421551SDag-Erling Smørgrav 51bc421551SDag-Erling Smørgrav /* 52bc421551SDag-Erling Smørgrav ** . . .followed by. . . 53bc421551SDag-Erling Smørgrav ** 54bc421551SDag-Erling Smørgrav ** tzh_timecnt (char [4])s coded transition times a la time(2) 55bc421551SDag-Erling Smørgrav ** tzh_timecnt (unsigned char)s types of local time starting at above 56bc421551SDag-Erling Smørgrav ** tzh_typecnt repetitions of 57bc421551SDag-Erling Smørgrav ** one (char [4]) coded UT offset in seconds 58bc421551SDag-Erling Smørgrav ** one (unsigned char) used to set tm_isdst 59bc421551SDag-Erling Smørgrav ** one (unsigned char) that's an abbreviation list index 60bc421551SDag-Erling Smørgrav ** tzh_charcnt (char)s '\0'-terminated zone abbreviations 61bc421551SDag-Erling Smørgrav ** tzh_leapcnt repetitions of 62bc421551SDag-Erling Smørgrav ** one (char [4]) coded leap second transition times 63bc421551SDag-Erling Smørgrav ** one (char [4]) total correction after above 64bc421551SDag-Erling Smørgrav ** tzh_ttisstdcnt (char)s indexed by type; if 1, transition 65bc421551SDag-Erling Smørgrav ** time is standard time, if 0, 66bc421551SDag-Erling Smørgrav ** transition time is local (wall clock) 67bc421551SDag-Erling Smørgrav ** time; if absent, transition times are 68bc421551SDag-Erling Smørgrav ** assumed to be local time 69bc421551SDag-Erling Smørgrav ** tzh_ttisutcnt (char)s indexed by type; if 1, transition 70bc421551SDag-Erling Smørgrav ** time is UT, if 0, transition time is 71bc421551SDag-Erling Smørgrav ** local time; if absent, transition 72bc421551SDag-Erling Smørgrav ** times are assumed to be local time. 73bc421551SDag-Erling Smørgrav ** When this is 1, the corresponding 74bc421551SDag-Erling Smørgrav ** std/wall indicator must also be 1. 75bc421551SDag-Erling Smørgrav */ 76bc421551SDag-Erling Smørgrav 77bc421551SDag-Erling Smørgrav /* 78bc421551SDag-Erling Smørgrav ** If tzh_version is '2' or greater, the above is followed by a second instance 79bc421551SDag-Erling Smørgrav ** of tzhead and a second instance of the data in which each coded transition 80bc421551SDag-Erling Smørgrav ** time uses 8 rather than 4 chars, 81*a979394aSDag-Erling Smørgrav ** then a POSIX.1-2017 proleptic TZ string for use in handling 82bc421551SDag-Erling Smørgrav ** instants after the last transition time stored in the file 8346c59934SDag-Erling Smørgrav ** (with nothing between the newlines if there is no POSIX.1-2017 8446c59934SDag-Erling Smørgrav ** representation for such instants). 85bc421551SDag-Erling Smørgrav ** 86*a979394aSDag-Erling Smørgrav ** If tz_version is '3' or greater, the TZ string can be any POSIX.1-2024 87*a979394aSDag-Erling Smørgrav ** proleptic TZ string, which means the above is extended as follows. 8846c59934SDag-Erling Smørgrav ** First, the TZ string's hour offset may range from -167 89*a979394aSDag-Erling Smørgrav ** through 167 as compared to the range 0 through 24 required 90*a979394aSDag-Erling Smørgrav ** by POSIX.1-2017 and earlier. 91bc421551SDag-Erling Smørgrav ** Second, its DST start time may be January 1 at 00:00 and its stop 92bc421551SDag-Erling Smørgrav ** time December 31 at 24:00 plus the difference between DST and 93bc421551SDag-Erling Smørgrav ** standard time, indicating DST all year. 94bc421551SDag-Erling Smørgrav */ 95bc421551SDag-Erling Smørgrav 96bc421551SDag-Erling Smørgrav /* 97bc421551SDag-Erling Smørgrav ** In the current implementation, "tzset()" refuses to deal with files that 98bc421551SDag-Erling Smørgrav ** exceed any of the limits below. 99bc421551SDag-Erling Smørgrav */ 100bc421551SDag-Erling Smørgrav 101bc421551SDag-Erling Smørgrav #ifndef TZ_MAX_TIMES 10275411d15SDag-Erling Smørgrav /* This must be at least 242 for Europe/London with 'zic -b fat'. */ 103bc421551SDag-Erling Smørgrav # define TZ_MAX_TIMES 2000 104bc421551SDag-Erling Smørgrav #endif /* !defined TZ_MAX_TIMES */ 105bc421551SDag-Erling Smørgrav 106bc421551SDag-Erling Smørgrav #ifndef TZ_MAX_TYPES 10775411d15SDag-Erling Smørgrav /* This must be at least 18 for Europe/Vilnius with 'zic -b fat'. */ 108bc421551SDag-Erling Smørgrav # define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ 109bc421551SDag-Erling Smørgrav #endif /* !defined TZ_MAX_TYPES */ 110bc421551SDag-Erling Smørgrav 111bc421551SDag-Erling Smørgrav #ifndef TZ_MAX_CHARS 11275411d15SDag-Erling Smørgrav /* This must be at least 40 for America/Anchorage. */ 113bc421551SDag-Erling Smørgrav # define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ 114bc421551SDag-Erling Smørgrav /* (limited by what unsigned chars can hold) */ 115bc421551SDag-Erling Smørgrav #endif /* !defined TZ_MAX_CHARS */ 116bc421551SDag-Erling Smørgrav 117bc421551SDag-Erling Smørgrav #ifndef TZ_MAX_LEAPS 11875411d15SDag-Erling Smørgrav /* This must be at least 27 for leap seconds from 1972 through mid-2023. 11975411d15SDag-Erling Smørgrav There's a plan to discontinue leap seconds by 2035. */ 120bc421551SDag-Erling Smørgrav # define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ 121bc421551SDag-Erling Smørgrav #endif /* !defined TZ_MAX_LEAPS */ 122bc421551SDag-Erling Smørgrav 123bc421551SDag-Erling Smørgrav #endif /* !defined TZFILE_H */ 124