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