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