1 /* 2 * Copyright (c) 1988 Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Arthur Olson. 7 * 8 * Redistribution and use in source and binary forms are permitted 9 * provided that the above copyright notice and this paragraph are 10 * duplicated in all such forms and that any documentation, 11 * advertising materials, and other materials related to such 12 * distribution and use acknowledge that the software was developed 13 * by the University of California, Berkeley. The name of the 14 * University may not be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19 * 20 * @(#)tzfile.h 5.6 (Berkeley) 08/21/89 21 */ 22 23 /* 24 ** Information about time zone files. 25 */ 26 27 /* Time zone object file directory */ 28 #define TZDIR "/etc/zoneinfo" 29 #define TZDEFAULT "localtime" 30 #define TZDEFRULES "posixrules" 31 32 /* 33 ** Each file begins with. . . 34 */ 35 36 struct tzhead { 37 char tzh_reserved[24]; /* reserved for future use */ 38 char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ 39 char tzh_leapcnt[4]; /* coded number of leap seconds */ 40 char tzh_timecnt[4]; /* coded number of transition times */ 41 char tzh_typecnt[4]; /* coded number of local time types */ 42 char tzh_charcnt[4]; /* coded number of abbr. chars */ 43 }; 44 45 /* 46 ** . . .followed by. . . 47 ** 48 ** tzh_timecnt (char [4])s coded transition times a la time(2) 49 ** tzh_timecnt (unsigned char)s types of local time starting at above 50 ** tzh_typecnt repetitions of 51 ** one (char [4]) coded GMT offset in seconds 52 ** one (unsigned char) used to set tm_isdst 53 ** one (unsigned char) that's an abbreviation list index 54 ** tzh_charcnt (char)s '\0'-terminated zone abbreviations 55 ** tzh_leapcnt repetitions of 56 ** one (char [4]) coded leap second transition times 57 ** one (char [4]) total correction after above 58 ** tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition 59 ** time is standard time, if FALSE, 60 ** transition time is wall clock time 61 ** if absent, transition times are 62 ** assumed to be wall clock time 63 */ 64 65 /* 66 ** In the current implementation, "tzset()" refuses to deal with files that 67 ** exceed any of the limits below. 68 */ 69 70 /* 71 ** The TZ_MAX_TIMES value below is enough to handle a bit more than a 72 ** year's worth of solar time (corrected daily to the nearest second) or 73 ** 138 years of Pacific Presidential Election time 74 ** (where there are three time zone transitions every fourth year). 75 */ 76 #define TZ_MAX_TIMES 370 77 78 #define NOSOLAR /* 4BSD doesn't currently handle solar time */ 79 80 #ifndef NOSOLAR 81 #define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ 82 #else 83 #define TZ_MAX_TYPES 10 /* Maximum number of local time types */ 84 #endif 85 86 #define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ 87 88 #define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ 89 90 #define SECSPERMIN 60 91 #define MINSPERHOUR 60 92 #define HOURSPERDAY 24 93 #define DAYSPERWEEK 7 94 #define DAYSPERNYEAR 365 95 #define DAYSPERLYEAR 366 96 #define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) 97 #define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY) 98 #define MONSPERYEAR 12 99 100 #define TM_SUNDAY 0 101 #define TM_MONDAY 1 102 #define TM_TUESDAY 2 103 #define TM_WEDNESDAY 3 104 #define TM_THURSDAY 4 105 #define TM_FRIDAY 5 106 #define TM_SATURDAY 6 107 108 #define TM_JANUARY 0 109 #define TM_FEBRUARY 1 110 #define TM_MARCH 2 111 #define TM_APRIL 3 112 #define TM_MAY 4 113 #define TM_JUNE 5 114 #define TM_JULY 6 115 #define TM_AUGUST 7 116 #define TM_SEPTEMBER 8 117 #define TM_OCTOBER 9 118 #define TM_NOVEMBER 10 119 #define TM_DECEMBER 11 120 121 #define TM_YEAR_BASE 1900 122 123 #define EPOCH_YEAR 1970 124 #define EPOCH_WDAY TM_THURSDAY 125 126 /* 127 ** Accurate only for the past couple of centuries; 128 ** that will probably do. 129 */ 130 131 #define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0) 132