1 #ifndef TZFILE_H 2 3 #define TZFILE_H 4 5 /* 6 ** This file is in the public domain, so clarified as of 7 ** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov). 8 */ 9 10 /* 11 ** This header is for use ONLY with the time conversion code. 12 ** There is no guarantee that it will remain unchanged, 13 ** or that it will remain at all. 14 ** Do NOT copy it to any system include directory. 15 ** Thank you! 16 */ 17 18 /* 19 ** Information about time zone files. 20 */ 21 22 #ifndef TZDEFAULT 23 #define TZDEFAULT "localtime" 24 #endif /* !defined TZDEFAULT */ 25 26 #ifndef TZDEFRULES 27 #define TZDEFRULES "posixrules" 28 #endif /* !defined TZDEFRULES */ 29 30 /* 31 ** Each file begins with. . . 32 */ 33 34 #define TZ_MAGIC "TZif" 35 36 struct tzhead { 37 char tzh_magic[4]; /* TZ_MAGIC */ 38 char tzh_reserved[16]; /* reserved for future use */ 39 char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */ 40 char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ 41 char tzh_leapcnt[4]; /* coded number of leap seconds */ 42 char tzh_timecnt[4]; /* coded number of transition times */ 43 char tzh_typecnt[4]; /* coded number of local time types */ 44 char tzh_charcnt[4]; /* coded number of abbr. chars */ 45 }; 46 47 /* 48 ** . . .followed by. . . 49 ** 50 ** tzh_timecnt (char [4])s coded transition times a la time(2) 51 ** tzh_timecnt (unsigned char)s types of local time starting at above 52 ** tzh_typecnt repetitions of 53 ** one (char [4]) coded UTC offset in seconds 54 ** one (unsigned char) used to set tm_isdst 55 ** one (unsigned char) that's an abbreviation list index 56 ** tzh_charcnt (char)s '\0'-terminated zone abbreviations 57 ** tzh_leapcnt repetitions of 58 ** one (char [4]) coded leap second transition times 59 ** one (char [4]) total correction after above 60 ** tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition 61 ** time is standard time, if FALSE, 62 ** transition time is wall clock time 63 ** if absent, transition times are 64 ** assumed to be wall clock time 65 ** tzh_ttisgmtcnt (char)s indexed by type; if TRUE, transition 66 ** time is UTC, if FALSE, 67 ** transition time is local time 68 ** if absent, transition times are 69 ** assumed to be local time 70 */ 71 72 /* 73 ** In the current implementation, "tzset()" refuses to deal with files that 74 ** exceed any of the limits below. 75 */ 76 77 #ifndef TZ_MAX_TIMES 78 /* 79 ** The TZ_MAX_TIMES value below is enough to handle a bit more than a 80 ** year's worth of solar time (corrected daily to the nearest second) or 81 ** 138 years of Pacific Presidential Election time 82 ** (where there are three time zone transitions every fourth year). 83 */ 84 #define TZ_MAX_TIMES 370 85 #endif /* !defined TZ_MAX_TIMES */ 86 87 #ifndef TZ_MAX_TYPES 88 #ifndef NOSOLAR 89 #define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ 90 #endif /* !defined NOSOLAR */ 91 #ifdef NOSOLAR 92 /* 93 ** Must be at least 14 for Europe/Riga as of Jan 12 1995, 94 ** as noted by Earl Chew <earl@hpato.aus.hp.com>. 95 */ 96 #define TZ_MAX_TYPES 20 /* Maximum number of local time types */ 97 #endif /* !defined NOSOLAR */ 98 #endif /* !defined TZ_MAX_TYPES */ 99 100 #ifndef TZ_MAX_CHARS 101 #define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ 102 /* (limited by what unsigned chars can hold) */ 103 #endif /* !defined TZ_MAX_CHARS */ 104 105 #ifndef TZ_MAX_LEAPS 106 #define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ 107 #endif /* !defined TZ_MAX_LEAPS */ 108 109 #define SECSPERMIN 60 110 #define MINSPERHOUR 60 111 #define HOURSPERDAY 24 112 #define DAYSPERWEEK 7 113 #define DAYSPERNYEAR 365 114 #define DAYSPERLYEAR 366 115 #define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) 116 #define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY) 117 #define MONSPERYEAR 12 118 119 #define TM_SUNDAY 0 120 #define TM_MONDAY 1 121 #define TM_TUESDAY 2 122 #define TM_WEDNESDAY 3 123 #define TM_THURSDAY 4 124 #define TM_FRIDAY 5 125 #define TM_SATURDAY 6 126 127 #define TM_JANUARY 0 128 #define TM_FEBRUARY 1 129 #define TM_MARCH 2 130 #define TM_APRIL 3 131 #define TM_MAY 4 132 #define TM_JUNE 5 133 #define TM_JULY 6 134 #define TM_AUGUST 7 135 #define TM_SEPTEMBER 8 136 #define TM_OCTOBER 9 137 #define TM_NOVEMBER 10 138 #define TM_DECEMBER 11 139 140 #define TM_YEAR_BASE 1900 141 142 #define EPOCH_YEAR 1970 143 #define EPOCH_WDAY TM_THURSDAY 144 145 /* 146 ** Accurate only for the past couple of centuries; 147 ** that will probably do. 148 */ 149 150 #define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) 151 152 #ifndef USG 153 154 /* 155 ** Use of the underscored variants may cause problems if you move your code to 156 ** certain System-V-based systems; for maximum portability, use the 157 ** underscore-free variants. The underscored variants are provided for 158 ** backward compatibility only; they may disappear from future versions of 159 ** this file. 160 */ 161 162 #define SECS_PER_MIN SECSPERMIN 163 #define MINS_PER_HOUR MINSPERHOUR 164 #define HOURS_PER_DAY HOURSPERDAY 165 #define DAYS_PER_WEEK DAYSPERWEEK 166 #define DAYS_PER_NYEAR DAYSPERNYEAR 167 #define DAYS_PER_LYEAR DAYSPERLYEAR 168 #define SECS_PER_HOUR SECSPERHOUR 169 #define SECS_PER_DAY SECSPERDAY 170 #define MONS_PER_YEAR MONSPERYEAR 171 172 #endif /* !defined USG */ 173 174 #endif /* !defined TZFILE_H */ 175