:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / lib / msvcrt / time / tzfile.h
1 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
2 #ifndef __dj_include_tzfile_h__
3 #define __dj_include_tzfile_h__
4
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8
9 #ifndef __dj_ENFORCE_ANSI_FREESTANDING
10
11 #ifndef __STRICT_ANSI__
12
13 #ifndef _POSIX_SOURCE
14
15 /*
16  * Copyright (c) 1988 Regents of the University of California.
17  * All rights reserved.
18  *
19  * This code is derived from software contributed to Berkeley by
20  * Arthur David Olson of the National Cancer Institute.
21  *
22  * Redistribution and use in source and binary forms are permitted provided
23  * that: (1) source distributions retain this entire copyright notice and
24  * comment, and (2) distributions including binaries display the following
25  * acknowledgement:  ``This product includes software developed by the
26  * University of California, Berkeley and its contributors'' in the
27  * documentation or other materials provided with the distribution and in
28  * all advertising materials mentioning features or use of this software.
29  * Neither the name of the University nor the names of its contributors may
30  * be used to endorse or promote products derived from this software without
31  * specific prior written permission.
32  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
33  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
34  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
35  *
36  *      @(#)tzfile.h    5.9 (Berkeley) 6/11/90
37  */
38
39 /*
40 ** Information about time zone files.
41 */
42
43                         /* Time zone object file directory */
44 #define TZDIR           "/usr/share/zoneinfo"
45 #define TZDEFAULT       "/etc/localtime"
46 #define TZDEFRULES      "posixrules"
47
48 /*
49 ** Each file begins with. . .
50 */
51
52 struct tzhead {
53         char    tzh_reserved[24];       /* reserved for future use */
54         char    tzh_ttisstdcnt[4];      /* coded number of trans. time flags */
55         char    tzh_leapcnt[4];         /* coded number of leap seconds */
56         char    tzh_timecnt[4];         /* coded number of transition times */
57         char    tzh_typecnt[4];         /* coded number of local time types */
58         char    tzh_charcnt[4];         /* coded number of abbr. chars */
59 };
60
61 /*
62 ** . . .followed by. . .
63 **
64 **      tzh_timecnt (char [4])s         coded transition times a la time(2)
65 **      tzh_timecnt (unsigned char)s    types of local time starting at above
66 **      tzh_typecnt repetitions of
67 **              one (char [4])          coded GMT offset in seconds
68 **              one (unsigned char)     used to set tm_isdst
69 **              one (unsigned char)     that's an abbreviation list index
70 **      tzh_charcnt (char)s             '\0'-terminated zone abbreviations
71 **      tzh_leapcnt repetitions of
72 **              one (char [4])          coded leap second transition times
73 **              one (char [4])          total correction after above
74 **      tzh_ttisstdcnt (char)s          indexed by type; if TRUE, transition
75 **                                      time is standard time, if FALSE,
76 **                                      transition time is wall clock time
77 **                                      if absent, transition times are
78 **                                      assumed to be wall clock time
79 */
80
81 /*
82 ** In the current implementation, "tzset()" refuses to deal with files that
83 ** exceed any of the limits below.
84 */
85
86 /*
87 ** The TZ_MAX_TIMES value below is enough to handle a bit more than a
88 ** year's worth of solar time (corrected daily to the nearest second) or
89 ** 138 years of Pacific Presidential Election time
90 ** (where there are three time zone transitions every fourth year).
91 */
92 #define TZ_MAX_TIMES    370
93
94 #define NOSOLAR                 /* 4BSD doesn't currently handle solar time */
95
96 #ifndef NOSOLAR
97 #define TZ_MAX_TYPES    256     /* Limited by what (unsigned char)'s can hold */
98 #else
99 #define TZ_MAX_TYPES    10      /* Maximum number of local time types */
100 #endif
101
102 #define TZ_MAX_CHARS    50      /* Maximum number of abbreviation characters */
103
104 #define TZ_MAX_LEAPS    50      /* Maximum number of leap second corrections */
105
106 #define SECSPERMIN      60
107 #define MINSPERHOUR     60
108 #define HOURSPERDAY     24
109 #define DAYSPERWEEK     7
110 #define DAYSPERNYEAR    365
111 #define DAYSPERLYEAR    366
112 #define SECSPERHOUR     (SECSPERMIN * MINSPERHOUR)
113 #define SECSPERDAY      ((long) SECSPERHOUR * HOURSPERDAY)
114 #define MONSPERYEAR     12
115
116 #define TM_SUNDAY       0
117 #define TM_MONDAY       1
118 #define TM_TUESDAY      2
119 #define TM_WEDNESDAY    3
120 #define TM_THURSDAY     4
121 #define TM_FRIDAY       5
122 #define TM_SATURDAY     6
123
124 #define TM_JANUARY      0
125 #define TM_FEBRUARY     1
126 #define TM_MARCH        2
127 #define TM_APRIL        3
128 #define TM_MAY          4
129 #define TM_JUNE         5
130 #define TM_JULY         6
131 #define TM_AUGUST       7
132 #define TM_SEPTEMBER    8
133 #define TM_OCTOBER      9
134 #define TM_NOVEMBER     10
135 #define TM_DECEMBER     11
136
137 #define TM_YEAR_BASE    1900
138
139 #define EPOCH_YEAR      1970
140 #define EPOCH_WDAY      TM_THURSDAY
141
142 /*
143 ** Accurate only for the past couple of centuries;
144 ** that will probably do.
145 */
146
147 #define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
148
149 #endif /* !_POSIX_SOURCE */
150 #endif /* !__STRICT_ANSI__ */
151 #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
152
153 #ifndef __dj_ENFORCE_FUNCTION_CALLS
154 #endif /* !__dj_ENFORCE_FUNCTION_CALLS */
155
156 #ifdef __cplusplus
157 }
158 #endif
159
160 #endif /* __dj_include_tzfile_h__ */