]>
Commit | Line | Data |
---|---|---|
1815bff5 A |
1 | /* |
2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
d904471c A |
6 | * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights |
7 | * Reserved. This file contains Original Code and/or Modifications of | |
8 | * Original Code as defined in and that are subject to the Apple Public | |
9 | * Source License Version 1.0 (the 'License'). You may not use this file | |
10 | * except in compliance with the License. Please obtain a copy of the | |
11 | * License at http://www.apple.com/publicsource and read it before using | |
12 | * this file. | |
1815bff5 A |
13 | * |
14 | * The Original Code and all software distributed under the License are | |
15 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
d904471c A |
18 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the |
19 | * License for the specific language governing rights and limitations | |
20 | * under the License." | |
1815bff5 A |
21 | * |
22 | * @APPLE_LICENSE_HEADER_END@ | |
23 | */ | |
24 | /* $OpenBSD: tzfile.h,v 1.4 1997/01/14 03:16:52 millert Exp $ */ | |
25 | ||
26 | #ifndef TZFILE_H | |
27 | ||
28 | #define TZFILE_H | |
29 | ||
30 | /* | |
31 | ** This file is in the public domain, so clarified as of | |
32 | ** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov). | |
33 | */ | |
34 | ||
35 | /* | |
36 | ** This header is for use ONLY with the time conversion code. | |
37 | ** There is no guarantee that it will remain unchanged, | |
38 | ** or that it will remain at all. | |
39 | ** Do NOT copy it to any system include directory. | |
40 | ** Thank you! | |
41 | */ | |
42 | ||
43 | /* | |
44 | ** ID | |
45 | */ | |
46 | ||
47 | #if 0 | |
48 | #ifndef lint | |
49 | #ifndef NOID | |
50 | static char tzfilehid[] = "@(#)tzfile.h 7.9"; | |
51 | #endif /* !defined NOID */ | |
52 | #endif /* !defined lint */ | |
53 | #endif | |
54 | ||
55 | /* | |
56 | ** Information about time zone files. | |
57 | */ | |
58 | ||
59 | #ifndef TZDIR | |
60 | #define TZDIR "/usr/share/zoneinfo" /* Time zone object file directory */ | |
61 | #endif /* !defined TZDIR */ | |
62 | ||
63 | #ifndef TZDEFAULT | |
64 | #define TZDEFAULT "/etc/localtime" | |
65 | #endif /* !defined TZDEFAULT */ | |
66 | ||
67 | #ifndef TZDEFRULES | |
68 | #define TZDEFRULES "posixrules" | |
69 | #endif /* !defined TZDEFRULES */ | |
70 | ||
71 | /* | |
72 | ** Each file begins with. . . | |
73 | */ | |
74 | ||
75 | struct tzhead { | |
76 | char tzh_reserved[20]; /* reserved for future use */ | |
77 | char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */ | |
78 | char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ | |
79 | char tzh_leapcnt[4]; /* coded number of leap seconds */ | |
80 | char tzh_timecnt[4]; /* coded number of transition times */ | |
81 | char tzh_typecnt[4]; /* coded number of local time types */ | |
82 | char tzh_charcnt[4]; /* coded number of abbr. chars */ | |
83 | }; | |
84 | ||
85 | /* | |
86 | ** . . .followed by. . . | |
87 | ** | |
88 | ** tzh_timecnt (char [4])s coded transition times a la time(2) | |
89 | ** tzh_timecnt (unsigned char)s types of local time starting at above | |
90 | ** tzh_typecnt repetitions of | |
91 | ** one (char [4]) coded GMT offset in seconds | |
92 | ** one (unsigned char) used to set tm_isdst | |
93 | ** one (unsigned char) that's an abbreviation list index | |
94 | ** tzh_charcnt (char)s '\0'-terminated zone abbreviations | |
95 | ** tzh_leapcnt repetitions of | |
96 | ** one (char [4]) coded leap second transition times | |
97 | ** one (char [4]) total correction after above | |
98 | ** tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition | |
99 | ** time is standard time, if FALSE, | |
100 | ** transition time is wall clock time | |
101 | ** if absent, transition times are | |
102 | ** assumed to be wall clock time | |
103 | ** tzh_ttisgmtcnt (char)s indexed by type; if TRUE, transition | |
104 | ** time is GMT, if FALSE, | |
105 | ** transition time is local time | |
106 | ** if absent, transition times are | |
107 | ** assumed to be local time | |
108 | */ | |
109 | ||
110 | /* | |
111 | ** In the current implementation, "tzset()" refuses to deal with files that | |
112 | ** exceed any of the limits below. | |
113 | */ | |
114 | ||
115 | #ifndef TZ_MAX_TIMES | |
116 | /* | |
117 | ** The TZ_MAX_TIMES value below is enough to handle a bit more than a | |
118 | ** year's worth of solar time (corrected daily to the nearest second) or | |
119 | ** 138 years of Pacific Presidential Election time | |
120 | ** (where there are three time zone transitions every fourth year). | |
121 | */ | |
122 | #define TZ_MAX_TIMES 370 | |
123 | #endif /* !defined TZ_MAX_TIMES */ | |
124 | ||
125 | #ifndef TZ_MAX_TYPES | |
126 | #ifndef NOSOLAR | |
127 | #define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ | |
128 | #endif /* !defined NOSOLAR */ | |
129 | #ifdef NOSOLAR | |
130 | /* | |
131 | ** Must be at least 14 for Europe/Riga as of Jan 12 1995, | |
132 | ** as noted by Earl Chew <earl@hpato.aus.hp.com>. | |
133 | */ | |
134 | #define TZ_MAX_TYPES 20 /* Maximum number of local time types */ | |
135 | #endif /* !defined NOSOLAR */ | |
136 | #endif /* !defined TZ_MAX_TYPES */ | |
137 | ||
138 | #ifndef TZ_MAX_CHARS | |
139 | #define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ | |
140 | /* (limited by what unsigned chars can hold) */ | |
141 | #endif /* !defined TZ_MAX_CHARS */ | |
142 | ||
143 | #ifndef TZ_MAX_LEAPS | |
144 | #define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ | |
145 | #endif /* !defined TZ_MAX_LEAPS */ | |
146 | ||
147 | #define SECSPERMIN 60 | |
148 | #define MINSPERHOUR 60 | |
149 | #define HOURSPERDAY 24 | |
150 | #define DAYSPERWEEK 7 | |
151 | #define DAYSPERNYEAR 365 | |
152 | #define DAYSPERLYEAR 366 | |
153 | #define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) | |
154 | #define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY) | |
155 | #define MONSPERYEAR 12 | |
156 | ||
157 | #define TM_SUNDAY 0 | |
158 | #define TM_MONDAY 1 | |
159 | #define TM_TUESDAY 2 | |
160 | #define TM_WEDNESDAY 3 | |
161 | #define TM_THURSDAY 4 | |
162 | #define TM_FRIDAY 5 | |
163 | #define TM_SATURDAY 6 | |
164 | ||
165 | #define TM_JANUARY 0 | |
166 | #define TM_FEBRUARY 1 | |
167 | #define TM_MARCH 2 | |
168 | #define TM_APRIL 3 | |
169 | #define TM_MAY 4 | |
170 | #define TM_JUNE 5 | |
171 | #define TM_JULY 6 | |
172 | #define TM_AUGUST 7 | |
173 | #define TM_SEPTEMBER 8 | |
174 | #define TM_OCTOBER 9 | |
175 | #define TM_NOVEMBER 10 | |
176 | #define TM_DECEMBER 11 | |
177 | ||
178 | #define TM_YEAR_BASE 1900 | |
179 | ||
180 | #define EPOCH_YEAR 1970 | |
181 | #define EPOCH_WDAY TM_THURSDAY | |
182 | ||
183 | /* | |
184 | ** Accurate only for the past couple of centuries; | |
185 | ** that will probably do. | |
186 | */ | |
187 | ||
188 | #define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) | |
189 | ||
190 | #ifndef USG | |
191 | ||
192 | /* | |
193 | ** Use of the underscored variants may cause problems if you move your code to | |
194 | ** certain System-V-based systems; for maximum portability, use the | |
195 | ** underscore-free variants. The underscored variants are provided for | |
196 | ** backward compatibility only; they may disappear from future versions of | |
197 | ** this file. | |
198 | */ | |
199 | ||
200 | #define SECS_PER_MIN SECSPERMIN | |
201 | #define MINS_PER_HOUR MINSPERHOUR | |
202 | #define HOURS_PER_DAY HOURSPERDAY | |
203 | #define DAYS_PER_WEEK DAYSPERWEEK | |
204 | #define DAYS_PER_NYEAR DAYSPERNYEAR | |
205 | #define DAYS_PER_LYEAR DAYSPERLYEAR | |
206 | #define SECS_PER_HOUR SECSPERHOUR | |
207 | #define SECS_PER_DAY SECSPERDAY | |
208 | #define MONS_PER_YEAR MONSPERYEAR | |
209 | ||
210 | #endif /* !defined USG */ | |
211 | ||
212 | #endif /* !defined TZFILE_H */ |