00001 #ifndef TZFILE_H 00002 00003 #define TZFILE_H 00004 00005 /*! \brief 00006 * This file is in the public domain, so clarified as of 00007 * 1996-06-05 by 00008 * \author Arthur David Olson (arthur_david_olson@nih.gov). 00009 * 00010 * \note This header is for use ONLY with the time conversion code. 00011 * There is no guarantee that it will remain unchanged, 00012 * or that it will remain at all. 00013 * Do NOT copy it to any system include directory. 00014 * Thank you! 00015 */ 00016 00017 /* 00018 ** ID 00019 */ 00020 00021 #ifndef lint 00022 #ifndef NOID 00023 /* 00024 static char tzfilehid[] = "@(#)tzfile.h 7.14"; 00025 */ 00026 #endif /* !defined NOID */ 00027 #endif /* !defined lint */ 00028 00029 /* 00030 ** Information about time zone files. 00031 */ 00032 00033 #ifndef TZDIR 00034 #define TZDIR "/usr/share/zoneinfo" /*!< Time zone object file directory */ 00035 #endif /* !defined TZDIR */ 00036 00037 #ifndef TZDEFAULT 00038 #define TZDEFAULT "/etc/localtime" 00039 #endif /* !defined TZDEFAULT */ 00040 00041 #ifndef TZDEFRULES 00042 #define TZDEFRULES "posixrules" 00043 #endif /* !defined TZDEFRULES */ 00044 00045 /* 00046 ** Each file begins with. . . 00047 */ 00048 00049 #define TZ_MAGIC "TZif" 00050 00051 struct tzhead { 00052 char tzh_magic[4]; /* TZ_MAGIC */ 00053 char tzh_reserved[16]; /* reserved for future use */ 00054 char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */ 00055 char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ 00056 char tzh_leapcnt[4]; /* coded number of leap seconds */ 00057 char tzh_timecnt[4]; /* coded number of transition times */ 00058 char tzh_typecnt[4]; /* coded number of local time types */ 00059 char tzh_charcnt[4]; /* coded number of abbr. chars */ 00060 }; 00061 00062 /* 00063 ** . . .followed by. . . 00064 ** 00065 ** tzh_timecnt (char [4])s coded transition times a la time(2) 00066 ** tzh_timecnt (unsigned char)s types of local time starting at above 00067 ** tzh_typecnt repetitions of 00068 ** one (char [4]) coded UTC offset in seconds 00069 ** one (unsigned char) used to set tm_isdst 00070 ** one (unsigned char) that's an abbreviation list index 00071 ** tzh_charcnt (char)s '\0'-terminated zone abbreviations 00072 ** tzh_leapcnt repetitions of 00073 ** one (char [4]) coded leap second transition times 00074 ** one (char [4]) total correction after above 00075 ** tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition 00076 ** time is standard time, if FALSE, 00077 ** transition time is wall clock time 00078 ** if absent, transition times are 00079 ** assumed to be wall clock time 00080 ** tzh_ttisgmtcnt (char)s indexed by type; if TRUE, transition 00081 ** time is UTC, if FALSE, 00082 ** transition time is local time 00083 ** if absent, transition times are 00084 ** assumed to be local time 00085 */ 00086 00087 /* 00088 ** In the current implementation, "tzset()" refuses to deal with files that 00089 ** exceed any of the limits below. 00090 */ 00091 00092 #ifndef TZ_MAX_TIMES 00093 /* 00094 ** The TZ_MAX_TIMES value below is enough to handle a bit more than a 00095 ** year's worth of solar time (corrected daily to the nearest second) or 00096 ** 138 years of Pacific Presidential Election time 00097 ** (where there are three time zone transitions every fourth year). 00098 */ 00099 #define TZ_MAX_TIMES 370 00100 #endif /* !defined TZ_MAX_TIMES */ 00101 00102 #ifndef TZ_MAX_TYPES 00103 #ifndef NOSOLAR 00104 #define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ 00105 #endif /* !defined NOSOLAR */ 00106 #ifdef NOSOLAR 00107 /* 00108 ** Must be at least 14 for Europe/Riga as of Jan 12 1995, 00109 ** as noted by Earl Chew <earl@hpato.aus.hp.com>. 00110 */ 00111 #define TZ_MAX_TYPES 20 /* Maximum number of local time types */ 00112 #endif /* !defined NOSOLAR */ 00113 #endif /* !defined TZ_MAX_TYPES */ 00114 00115 #ifndef TZ_MAX_CHARS 00116 #define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ 00117 /* (limited by what unsigned chars can hold) */ 00118 #endif /* !defined TZ_MAX_CHARS */ 00119 00120 #ifndef TZ_MAX_LEAPS 00121 #define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ 00122 #endif /* !defined TZ_MAX_LEAPS */ 00123 00124 #define SECSPERMIN 60 00125 #define MINSPERHOUR 60 00126 #define HOURSPERDAY 24 00127 #define DAYSPERWEEK 7 00128 #define DAYSPERNYEAR 365 00129 #define DAYSPERLYEAR 366 00130 #define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) 00131 #define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY) 00132 #define MONSPERYEAR 12 00133 00134 #define TM_SUNDAY 0 00135 #define TM_MONDAY 1 00136 #define TM_TUESDAY 2 00137 #define TM_WEDNESDAY 3 00138 #define TM_THURSDAY 4 00139 #define TM_FRIDAY 5 00140 #define TM_SATURDAY 6 00141 00142 #define TM_JANUARY 0 00143 #define TM_FEBRUARY 1 00144 #define TM_MARCH 2 00145 #define TM_APRIL 3 00146 #define TM_MAY 4 00147 #define TM_JUNE 5 00148 #define TM_JULY 6 00149 #define TM_AUGUST 7 00150 #define TM_SEPTEMBER 8 00151 #define TM_OCTOBER 9 00152 #define TM_NOVEMBER 10 00153 #define TM_DECEMBER 11 00154 00155 #define TM_YEAR_BASE 1900 00156 00157 #define EPOCH_YEAR 1970 00158 #define EPOCH_WDAY TM_THURSDAY 00159 00160 /* 00161 ** Accurate only for the past couple of centuries; 00162 ** that will probably do. 00163 */ 00164 00165 #define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) 00166 00167 #ifndef USG 00168 00169 /* 00170 ** Use of the underscored variants may cause problems if you move your code to 00171 ** certain System-V-based systems; for maximum portability, use the 00172 ** underscore-free variants. The underscored variants are provided for 00173 ** backward compatibility only; they may disappear from future versions of 00174 ** this file. 00175 */ 00176 00177 #define SECS_PER_MIN SECSPERMIN 00178 #define MINS_PER_HOUR MINSPERHOUR 00179 #define HOURS_PER_DAY HOURSPERDAY 00180 #define DAYS_PER_WEEK DAYSPERWEEK 00181 #define DAYS_PER_NYEAR DAYSPERNYEAR 00182 #define DAYS_PER_LYEAR DAYSPERLYEAR 00183 #define SECS_PER_HOUR SECSPERHOUR 00184 #define SECS_PER_DAY SECSPERDAY 00185 #define MONS_PER_YEAR MONSPERYEAR 00186 00187 #endif /* !defined USG */ 00188 00189 #endif /* !defined TZFILE_H */