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