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