tzfile.h revision 9936
1#ifndef TZFILE_H
2
3#define TZFILE_H
4
5/*
6** This header is for use ONLY with the time conversion code.
7** There is no guarantee that it will remain unchanged,
8** or that it will remain at all.
9** Do NOT copy it to any system include directory.
10** Thank you!
11*/
12
13/*
14** ID
15*/
16
17#ifndef lint
18#ifndef NOID
19/*static char	tzfilehid[] = "@(#)tzfile.h	7.6";*/
20#endif /* !defined NOID */
21#endif /* !defined lint */
22
23/*
24** Information about time zone files.
25*/
26
27#ifndef TZDIR
28#define TZDIR	"/usr/share/zoneinfo" /* Time zone object file directory */
29#endif /* !defined TZDIR */
30
31#ifndef TZDEFAULT
32#define TZDEFAULT	"/etc/localtime"
33#endif /* !defined TZDEFAULT */
34
35#ifndef TZDEFRULES
36#define TZDEFRULES	"posixrules"
37#endif /* !defined TZDEFRULES */
38
39/*
40** Each file begins with. . .
41*/
42
43struct tzhead {
44	char	tzh_reserved[20];	/* reserved for future use */
45	char	tzh_ttisgmtcnt[4];	/* coded number of trans. time flags */
46	char	tzh_ttisstdcnt[4];	/* coded number of trans. time flags */
47	char	tzh_leapcnt[4];		/* coded number of leap seconds */
48	char	tzh_timecnt[4];		/* coded number of transition times */
49	char	tzh_typecnt[4];		/* coded number of local time types */
50	char	tzh_charcnt[4];		/* coded number of abbr. chars */
51};
52
53/*
54** . . .followed by. . .
55**
56**	tzh_timecnt (char [4])s		coded transition times a la time(2)
57**	tzh_timecnt (unsigned char)s	types of local time starting at above
58**	tzh_typecnt repetitions of
59**		one (char [4])		coded GMT offset in seconds
60**		one (unsigned char)	used to set tm_isdst
61**		one (unsigned char)	that's an abbreviation list index
62**	tzh_charcnt (char)s		'\0'-terminated zone abbreviations
63**	tzh_leapcnt repetitions of
64**		one (char [4])		coded leap second transition times
65**		one (char [4])		total correction after above
66**	tzh_ttisstdcnt (char)s		indexed by type; if TRUE, transition
67**					time is standard time, if FALSE,
68**					transition time is wall clock time
69**					if absent, transition times are
70**					assumed to be wall clock time
71**	tzh_ttisgmtcnt (char)s		indexed by type; if TRUE, transition
72**					time is GMT, if FALSE,
73**					transition time is local time
74**					if absent, transition times are
75**					assumed to be local time
76*/
77
78/*
79** In the current implementation, "tzset()" refuses to deal with files that
80** exceed any of the limits below.
81*/
82
83#ifndef TZ_MAX_TIMES
84/*
85** The TZ_MAX_TIMES value below is enough to handle a bit more than a
86** year's worth of solar time (corrected daily to the nearest second) or
87** 138 years of Pacific Presidential Election time
88** (where there are three time zone transitions every fourth year).
89*/
90#define TZ_MAX_TIMES	370
91#endif /* !defined TZ_MAX_TIMES */
92
93#ifndef TZ_MAX_TYPES
94#ifndef NOSOLAR
95#define TZ_MAX_TYPES	256 /* Limited by what (unsigned char)'s can hold */
96#endif /* !defined NOSOLAR */
97#ifdef NOSOLAR
98/*
99** Must be at least 14 for Europe/Riga as of Jan 12 1995,
100** as noted by Earl Chew <earl@hpato.aus.hp.com>.
101*/
102#define TZ_MAX_TYPES	20	/* Maximum number of local time types */
103#endif /* !defined NOSOLAR */
104#endif /* !defined TZ_MAX_TYPES */
105
106#ifndef TZ_MAX_CHARS
107#define TZ_MAX_CHARS	50	/* Maximum number of abbreviation characters */
108				/* (limited by what unsigned chars can hold) */
109#endif /* !defined TZ_MAX_CHARS */
110
111#ifndef TZ_MAX_LEAPS
112#define TZ_MAX_LEAPS	50	/* Maximum number of leap second corrections */
113#endif /* !defined TZ_MAX_LEAPS */
114
115#define SECSPERMIN	60
116#define MINSPERHOUR	60
117#define HOURSPERDAY	24
118#define DAYSPERWEEK	7
119#define DAYSPERNYEAR	365
120#define DAYSPERLYEAR	366
121#define SECSPERHOUR	(SECSPERMIN * MINSPERHOUR)
122#define SECSPERDAY	((long) SECSPERHOUR * HOURSPERDAY)
123#define MONSPERYEAR	12
124
125#define TM_SUNDAY	0
126#define TM_MONDAY	1
127#define TM_TUESDAY	2
128#define TM_WEDNESDAY	3
129#define TM_THURSDAY	4
130#define TM_FRIDAY	5
131#define TM_SATURDAY	6
132
133#define TM_JANUARY	0
134#define TM_FEBRUARY	1
135#define TM_MARCH	2
136#define TM_APRIL	3
137#define TM_MAY		4
138#define TM_JUNE		5
139#define TM_JULY		6
140#define TM_AUGUST	7
141#define TM_SEPTEMBER	8
142#define TM_OCTOBER	9
143#define TM_NOVEMBER	10
144#define TM_DECEMBER	11
145
146#define TM_YEAR_BASE	1900
147
148#define EPOCH_YEAR	1970
149#define EPOCH_WDAY	TM_THURSDAY
150
151/*
152** Accurate only for the past couple of centuries;
153** that will probably do.
154*/
155
156#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
157
158#ifndef USG
159
160/*
161** Use of the underscored variants may cause problems if you move your code to
162** certain System-V-based systems; for maximum portability, use the
163** underscore-free variants.  The underscored variants are provided for
164** backward compatibility only; they may disappear from future versions of
165** this file.
166*/
167
168#define SECS_PER_MIN	SECSPERMIN
169#define MINS_PER_HOUR	MINSPERHOUR
170#define HOURS_PER_DAY	HOURSPERDAY
171#define DAYS_PER_WEEK	DAYSPERWEEK
172#define DAYS_PER_NYEAR	DAYSPERNYEAR
173#define DAYS_PER_LYEAR	DAYSPERLYEAR
174#define SECS_PER_HOUR	SECSPERHOUR
175#define SECS_PER_DAY	SECSPERDAY
176#define MONS_PER_YEAR	MONSPERYEAR
177
178#endif /* !defined USG */
179
180#endif /* !defined TZFILE_H */
181