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 David Olson of the National Cancer Institute. 7 * 8 * %sccs.include.redist.c% 9 * 10 * @(#)tzfile.h 5.9 (Berkeley) 06/11/90 11 */ 12 13 /* 14 ** Information about time zone files. 15 */ 16 17 /* Time zone object file directory */ 18 #define TZDIR "/usr/share/zoneinfo" 19 #define TZDEFAULT "/etc/localtime" 20 #define TZDEFRULES "posixrules" 21 22 /* 23 ** Each file begins with. . . 24 */ 25 26 struct tzhead { 27 char tzh_reserved[24]; /* reserved for future use */ 28 char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ 29 char tzh_leapcnt[4]; /* coded number of leap seconds */ 30 char tzh_timecnt[4]; /* coded number of transition times */ 31 char tzh_typecnt[4]; /* coded number of local time types */ 32 char tzh_charcnt[4]; /* coded number of abbr. chars */ 33 }; 34 35 /* 36 ** . . .followed by. . . 37 ** 38 ** tzh_timecnt (char [4])s coded transition times a la time(2) 39 ** tzh_timecnt (unsigned char)s types of local time starting at above 40 ** tzh_typecnt repetitions of 41 ** one (char [4]) coded GMT offset in seconds 42 ** one (unsigned char) used to set tm_isdst 43 ** one (unsigned char) that's an abbreviation list index 44 ** tzh_charcnt (char)s '\0'-terminated zone abbreviations 45 ** tzh_leapcnt repetitions of 46 ** one (char [4]) coded leap second transition times 47 ** one (char [4]) total correction after above 48 ** tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition 49 ** time is standard time, if FALSE, 50 ** transition time is wall clock time 51 ** if absent, transition times are 52 ** assumed to be wall clock time 53 */ 54 55 /* 56 ** In the current implementation, "tzset()" refuses to deal with files that 57 ** exceed any of the limits below. 58 */ 59 60 /* 61 ** The TZ_MAX_TIMES value below is enough to handle a bit more than a 62 ** year's worth of solar time (corrected daily to the nearest second) or 63 ** 138 years of Pacific Presidential Election time 64 ** (where there are three time zone transitions every fourth year). 65 */ 66 #define TZ_MAX_TIMES 370 67 68 #define NOSOLAR /* 4BSD doesn't currently handle solar time */ 69 70 #ifndef NOSOLAR 71 #define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ 72 #else 73 #define TZ_MAX_TYPES 10 /* Maximum number of local time types */ 74 #endif 75 76 #define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ 77 78 #define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ 79 80 #define SECSPERMIN 60 81 #define MINSPERHOUR 60 82 #define HOURSPERDAY 24 83 #define DAYSPERWEEK 7 84 #define DAYSPERNYEAR 365 85 #define DAYSPERLYEAR 366 86 #define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) 87 #define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY) 88 #define MONSPERYEAR 12 89 90 #define TM_SUNDAY 0 91 #define TM_MONDAY 1 92 #define TM_TUESDAY 2 93 #define TM_WEDNESDAY 3 94 #define TM_THURSDAY 4 95 #define TM_FRIDAY 5 96 #define TM_SATURDAY 6 97 98 #define TM_JANUARY 0 99 #define TM_FEBRUARY 1 100 #define TM_MARCH 2 101 #define TM_APRIL 3 102 #define TM_MAY 4 103 #define TM_JUNE 5 104 #define TM_JULY 6 105 #define TM_AUGUST 7 106 #define TM_SEPTEMBER 8 107 #define TM_OCTOBER 9 108 #define TM_NOVEMBER 10 109 #define TM_DECEMBER 11 110 111 #define TM_YEAR_BASE 1900 112 113 #define EPOCH_YEAR 1970 114 #define EPOCH_WDAY TM_THURSDAY 115 116 /* 117 ** Accurate only for the past couple of centuries; 118 ** that will probably do. 119 */ 120 121 #define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0) 122