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