390.1.2
by Monty Taylor
Fixed copyright headers in drizzled/ |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 Sun Microsystems
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; either version 2 of the License, or
|
|
9 |
* (at your option) any later version.
|
|
10 |
*
|
|
11 |
* This program is distributed in the hope that it will be useful,
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License
|
|
17 |
* along with this program; if not, write to the Free Software
|
|
18 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
19 |
*/
|
|
20 |
||
21 |
/*
|
|
1
by brian
clean slate |
22 |
This file is based on public domain code from ftp://elsie.ncih.nist.gov/
|
23 |
Initial source code is in the public domain, so clarified as of
|
|
390.1.2
by Monty Taylor
Fixed copyright headers in drizzled/ |
24 |
1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
|
1
by brian
clean slate |
25 |
*/
|
26 |
||
27 |
/*
|
|
28 |
Information about time zone files.
|
|
29 |
*/
|
|
30 |
||
1122.2.10
by Monty Taylor
Fixed all of the include guards. |
31 |
#ifndef DRIZZLED_TZFILE_H
|
32 |
#define DRIZZLED_TZFILE_H
|
|
33 |
||
1
by brian
clean slate |
34 |
#ifndef TZDIR
|
35 |
#define TZDIR "/usr/share/zoneinfo" /* Time zone object file directory */ |
|
36 |
#endif /* !defined TZDIR */ |
|
37 |
||
38 |
/*
|
|
39 |
Each file begins with. . .
|
|
40 |
*/
|
|
41 |
||
42 |
#define TZ_MAGIC "TZif"
|
|
43 |
||
44 |
struct tzhead { |
|
481
by Brian Aker
Remove all of uchar. |
45 |
unsigned char tzh_magic[4]; /* TZ_MAGIC */ |
46 |
unsigned char tzh_reserved[16]; /* reserved for future use */ |
|
47 |
unsigned char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */ |
|
48 |
unsigned char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ |
|
49 |
unsigned char tzh_leapcnt[4]; /* coded number of leap seconds */ |
|
50 |
unsigned char tzh_timecnt[4]; /* coded number of transition times */ |
|
51 |
unsigned char tzh_typecnt[4]; /* coded number of local time types */ |
|
52 |
unsigned char tzh_charcnt[4]; /* coded number of abbr. chars */ |
|
1
by brian
clean slate |
53 |
};
|
54 |
||
55 |
/*
|
|
56 |
. . .followed by. . .
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
57 |
|
1
by brian
clean slate |
58 |
tzh_timecnt (char [4])s coded transition times a la time(2)
|
59 |
tzh_timecnt (unsigned char)s types of local time starting at above
|
|
60 |
tzh_typecnt repetitions of
|
|
61 |
one (char [4]) coded UTC offset in seconds
|
|
62 |
one (unsigned char) used to set tm_isdst
|
|
63 |
one (unsigned char) that's an abbreviation list index
|
|
64 |
tzh_charcnt (char)s '\0'-terminated zone abbreviations
|
|
65 |
tzh_leapcnt repetitions of
|
|
66 |
one (char [4]) coded leap second transition times
|
|
67 |
one (char [4]) total correction after above
|
|
51.1.71
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
68 |
tzh_ttisstdcnt (char)s indexed by type; if true, transition
|
69 |
time is standard time, if false,
|
|
1
by brian
clean slate |
70 |
transition time is wall clock time
|
71 |
if absent, transition times are
|
|
72 |
assumed to be wall clock time
|
|
51.1.71
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
73 |
tzh_ttisgmtcnt (char)s indexed by type; if true, transition
|
74 |
time is UTC, if false,
|
|
1
by brian
clean slate |
75 |
transition time is local time
|
76 |
if absent, transition times are
|
|
77 |
assumed to be local time
|
|
78 |
*/
|
|
79 |
||
80 |
/*
|
|
81 |
In the current implementation, we refuse to deal with files that
|
|
82 |
exceed any of the limits below.
|
|
83 |
*/
|
|
84 |
||
85 |
#ifndef TZ_MAX_TIMES
|
|
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 |
#endif /* !defined TZ_MAX_TIMES */ |
|
94 |
||
95 |
#ifndef TZ_MAX_TYPES
|
|
96 |
#ifdef SOLAR
|
|
97 |
#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ |
|
98 |
#else
|
|
99 |
/*
|
|
100 |
Must be at least 14 for Europe/Riga as of Jan 12 1995,
|
|
101 |
as noted by Earl Chew <earl@hpato.aus.hp.com>.
|
|
102 |
*/
|
|
103 |
#define TZ_MAX_TYPES 20 /* Maximum number of local time types */ |
|
104 |
#endif /* defined SOLAR */ |
|
105 |
#endif /* !defined TZ_MAX_TYPES */ |
|
106 |
||
107 |
#ifndef TZ_MAX_CHARS
|
|
108 |
#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ |
|
109 |
/* (limited by what unsigned chars can hold) */
|
|
110 |
#endif /* !defined TZ_MAX_CHARS */ |
|
111 |
||
112 |
#ifndef TZ_MAX_LEAPS
|
|
113 |
#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ |
|
114 |
#endif /* !defined TZ_MAX_LEAPS */ |
|
115 |
||
116 |
#ifndef TZ_MAX_REV_RANGES
|
|
117 |
#ifdef SOLAR
|
|
118 |
/* Solar (Asia/RiyadhXX) zones need significantly bigger TZ_MAX_REV_RANGES */
|
|
119 |
#define TZ_MAX_REV_RANGES (TZ_MAX_TIMES*2+TZ_MAX_LEAPS*2+2)
|
|
120 |
#else
|
|
121 |
#define TZ_MAX_REV_RANGES (TZ_MAX_TIMES+TZ_MAX_LEAPS+2)
|
|
122 |
#endif
|
|
123 |
#endif
|
|
124 |
||
125 |
#define SECS_PER_MIN 60
|
|
126 |
#define MINS_PER_HOUR 60
|
|
127 |
#define HOURS_PER_DAY 24
|
|
128 |
#define DAYS_PER_WEEK 7
|
|
129 |
#define DAYS_PER_NYEAR 365
|
|
130 |
#define DAYS_PER_LYEAR 366
|
|
131 |
#define SECS_PER_HOUR (SECS_PER_MIN * MINS_PER_HOUR)
|
|
132 |
#define SECS_PER_DAY ((long) SECS_PER_HOUR * HOURS_PER_DAY)
|
|
133 |
#define MONS_PER_YEAR 12
|
|
134 |
||
135 |
#define TM_YEAR_BASE 1900
|
|
136 |
||
137 |
#define EPOCH_YEAR 1970
|
|
138 |
||
139 |
/*
|
|
140 |
Accurate only for the past couple of centuries,
|
|
141 |
that will probably do.
|
|
142 |
*/
|
|
143 |
||
144 |
#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
|
|
1122.2.10
by Monty Taylor
Fixed all of the include guards. |
145 |
|
146 |
#endif /* DRIZZLED_TZFILE_H */ |