Commit | Line | Data |
---|---|---|
6949fc73 KB |
1 | /* |
2 | * Copyright (c) 1987 Regents of the University of California. | |
3 | * All rights reserved. The Berkeley software License Agreement | |
4 | * specifies the terms and conditions for redistribution. | |
5 | * | |
6 | * @(#)tzfile.h 5.1 (Berkeley) %G% | |
7 | */ | |
8 | ||
9 | /* | |
10 | ** Information about time zone files. | |
11 | */ | |
12 | ||
13 | #define TZDIR "/etc/zoneinfo" /* Time zone object file directory */ | |
14 | #define TZDEFAULT "localtime" | |
15 | ||
16 | /* | |
17 | ** Each file begins with. . . | |
18 | */ | |
19 | ||
20 | struct tzhead { | |
21 | char tzh_reserved[32]; /* reserved for future use */ | |
22 | char tzh_timecnt[4]; /* coded number of transition times */ | |
23 | char tzh_typecnt[4]; /* coded number of local time types */ | |
24 | char tzh_charcnt[4]; /* coded number of abbr. chars */ | |
25 | }; | |
26 | ||
27 | /* | |
28 | ** . . .followed by. . . | |
29 | ** | |
30 | ** tzh_timecnt (char [4])s coded transition times a la time(2) | |
31 | ** tzh_timecnt (unsigned char)s types of local time starting at above | |
32 | ** tzh_typecnt repetitions of | |
33 | ** one (char [4]) coded GMT offset in seconds | |
34 | ** one (unsigned char) used to set tm_isdt | |
35 | ** one (unsigned char) that's an abbreviation list index | |
36 | ** tzh_charcnt (char)s '\0'-terminated zone abbreviaton strings | |
37 | */ | |
38 | ||
39 | /* | |
40 | ** In the current implementation, "tzset()" refuses to deal with files that | |
41 | ** exceed any of the limits below. | |
42 | */ | |
43 | ||
44 | /* | |
45 | ** The TZ_MAX_TIMES value below is enough to handle a bit more than a | |
46 | ** year's worth of solar time (corrected daily to the nearest second) or | |
47 | ** 138 years of Pacific Presidential Election time | |
48 | ** (where there are three time zone transitions every fourth year). | |
49 | */ | |
50 | #define TZ_MAX_TIMES 370 | |
51 | ||
52 | #define NOSOLAR /* We currently don't handle solar time */ | |
53 | ||
54 | #ifndef NOSOLAR | |
55 | #define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ | |
56 | #else /* !NOSOLAR */ | |
57 | #define TZ_MAX_TYPES 10 /* Maximum number of local time types */ | |
58 | #endif /* !NOSOLAR */ | |
59 | ||
60 | #define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ | |
61 | ||
62 | #define SECS_PER_MIN 60 | |
63 | #define MINS_PER_HOUR 60 | |
64 | #define HOURS_PER_DAY 24 | |
65 | #define DAYS_PER_WEEK 7 | |
66 | #define DAYS_PER_NYEAR 365 | |
67 | #define DAYS_PER_LYEAR 366 | |
68 | #define SECS_PER_HOUR (SECS_PER_MIN * MINS_PER_HOUR) | |
69 | #define SECS_PER_DAY ((long) SECS_PER_HOUR * HOURS_PER_DAY) | |
70 | #define MONS_PER_YEAR 12 | |
71 | ||
72 | #define TM_SUNDAY 0 | |
73 | #define TM_MONDAY 1 | |
74 | #define TM_TUESDAY 2 | |
75 | #define TM_WEDNESDAY 3 | |
76 | #define TM_THURSDAY 4 | |
77 | #define TM_FRIDAY 5 | |
78 | #define TM_SATURDAY 6 | |
79 | ||
80 | #define TM_JANUARY 0 | |
81 | #define TM_FEBRUARY 1 | |
82 | #define TM_MARCH 2 | |
83 | #define TM_APRIL 3 | |
84 | #define TM_MAY 4 | |
85 | #define TM_JUNE 5 | |
86 | #define TM_JULY 6 | |
87 | #define TM_AUGUST 7 | |
88 | #define TM_SEPTEMBER 8 | |
89 | #define TM_OCTOBER 9 | |
90 | #define TM_NOVEMBER 10 | |
91 | #define TM_DECEMBER 11 | |
92 | #define TM_SUNDAY 0 | |
93 | ||
94 | #define TM_YEAR_BASE 1900 | |
95 | ||
96 | #define EPOCH_YEAR 1970 | |
97 | #define EPOCH_WDAY TM_THURSDAY | |
98 | ||
99 | /* | |
100 | ** Accurate only for the past couple of centuries; | |
101 | ** that will probably do. | |
102 | */ | |
103 | ||
104 | #define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0) |