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