]> git.proxmox.com Git - mirror_edk2.git/blob - StdLib/LibC/Time/tzfile.h
Standard Libraries for EDK II.
[mirror_edk2.git] / StdLib / LibC / Time / tzfile.h
1 /** @file
2 Time Zone processing, declarations and macros.
3
4 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 Derived from the NIH time zone package file, tzfile.h, which contains the following notice:
14
15 This file is in the public domain, so clarified as of
16 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
17
18 This header is for use ONLY with the time conversion code.
19 There is no guarantee that it will remain unchanged,
20 or that it will remain at all.
21 Do NOT copy it to any system include directory.
22 Thank you!
23
24 NetBSD: tzfile.h,v 1.8 1998/01/22 07:06:59 jtc Exp
25 **/
26 #ifndef TZFILE_H
27 #define TZFILE_H
28
29 /*
30 ** Information about time zone files.
31 */
32
33 #ifndef TZDIR /* Time zone object file directory */
34 #define TZDIR "/usr/share/zoneinfo"
35 #endif /* !defined TZDIR */
36
37 #ifndef TZDEFAULT
38 #define TZDEFAULT "/etc/localtime"
39 #endif /* !defined TZDEFAULT */
40
41 #ifndef TZDEFRULES
42 #define TZDEFRULES "posixrules"
43 #endif /* !defined TZDEFRULES */
44
45 /*
46 ** Each file begins with. . .
47 */
48
49 #define TZ_MAGIC "TZif"
50
51 struct tzhead {
52 char tzh_magic[4]; /* TZ_MAGIC */
53 char tzh_reserved[16]; /* reserved for future use */
54 char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */
55 char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
56 char tzh_leapcnt[4]; /* coded number of leap seconds */
57 char tzh_timecnt[4]; /* coded number of transition times */
58 char tzh_typecnt[4]; /* coded number of local time types */
59 char tzh_charcnt[4]; /* coded number of abbr. chars */
60 };
61
62 /*
63 ** . . .followed by. . .
64 **
65 ** tzh_timecnt (char [4])s coded transition times a la time(2)
66 ** tzh_timecnt (unsigned char)s types of local time starting at above
67 ** tzh_typecnt repetitions of
68 ** one (char [4]) coded UTC offset in seconds
69 ** one (unsigned char) used to set tm_isdst
70 ** one (unsigned char) that's an abbreviation list index
71 ** tzh_charcnt (char)s '\0'-terminated zone abbreviations
72 ** tzh_leapcnt repetitions of
73 ** one (char [4]) coded leap second transition times
74 ** one (char [4]) total correction after above
75 ** tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition
76 ** time is standard time, if FALSE,
77 ** transition time is wall clock time
78 ** if absent, transition times are
79 ** assumed to be wall clock time
80 ** tzh_ttisgmtcnt (char)s indexed by type; if TRUE, transition
81 ** time is UTC, if FALSE,
82 ** transition time is local time
83 ** if absent, transition times are
84 ** assumed to be local time
85 */
86
87 /*
88 ** In the current implementation, "tzset()" refuses to deal with files that
89 ** exceed any of the limits below.
90 */
91
92 #ifndef TZ_MAX_TIMES
93 /*
94 ** The TZ_MAX_TIMES value below is enough to handle a bit more than a
95 ** year's worth of solar time (corrected daily to the nearest second) or
96 ** 138 years of Pacific Presidential Election time
97 ** (where there are three time zone transitions every fourth year).
98 */
99 #define TZ_MAX_TIMES 370
100 #endif /* !defined TZ_MAX_TIMES */
101
102 #ifndef TZ_MAX_TYPES
103 #ifndef NOSOLAR
104 #define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */
105 #endif /* !defined NOSOLAR */
106 #ifdef NOSOLAR
107 /*
108 ** Must be at least 14 for Europe/Riga as of Jan 12 1995,
109 ** as noted by Earl Chew <earl@hpato.aus.hp.com>.
110 */
111 #define TZ_MAX_TYPES 20 /* Maximum number of local time types */
112 #endif /* !defined NOSOLAR */
113 #endif /* !defined TZ_MAX_TYPES */
114
115 #ifndef TZ_MAX_CHARS
116 #define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */
117 /* (limited by what unsigned chars can hold) */
118 #endif /* !defined TZ_MAX_CHARS */
119
120 #ifndef TZ_MAX_LEAPS
121 #define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */
122 #endif /* !defined TZ_MAX_LEAPS */
123
124 #define SECSPERMIN 60
125 #define MINSPERHOUR 60
126 #define HOURSPERDAY 24
127 #define DAYSPERWEEK 7
128 #define DAYSPERNYEAR 365
129 #define DAYSPERLYEAR 366
130 #define SECSPERHOUR (SECSPERMIN * MINSPERHOUR)
131 #define SECSPERDAY ((LONG32)(SECSPERHOUR * HOURSPERDAY))
132 #define MONSPERYEAR 12
133
134 #define TM_SUNDAY 0
135 #define TM_MONDAY 1
136 #define TM_TUESDAY 2
137 #define TM_WEDNESDAY 3
138 #define TM_THURSDAY 4
139 #define TM_FRIDAY 5
140 #define TM_SATURDAY 6
141
142 #define TM_JANUARY 0
143 #define TM_FEBRUARY 1
144 #define TM_MARCH 2
145 #define TM_APRIL 3
146 #define TM_MAY 4
147 #define TM_JUNE 5
148 #define TM_JULY 6
149 #define TM_AUGUST 7
150 #define TM_SEPTEMBER 8
151 #define TM_OCTOBER 9
152 #define TM_NOVEMBER 10
153 #define TM_DECEMBER 11
154
155 #define TM_YEAR_BASE 1900
156
157 #define EPOCH_YEAR 1970
158 #define EPOCH_WDAY TM_THURSDAY // Use this for 32-bit time_t
159 //#define EPOCH_WDAY TM_SUNDAY // Use this for 64-bit time_t
160
161 /*
162 ** Accurate only for the past couple of centuries;
163 ** that will probably do.
164 */
165
166 #define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
167
168 #endif /* !defined TZFILE_H */