MySQL 9.0.0
Source Code Documentation
tzfile.h
Go to the documentation of this file.
1#ifndef TZFILE_INCLUDED
2#define TZFILE_INCLUDED
3
4/* Copyright (c) 2004, 2024, Oracle and/or its affiliates.
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, version 2.0,
8 as published by the Free Software Foundation.
9
10 This program is designed to work with certain software (including
11 but not limited to OpenSSL) that is licensed under separate terms,
12 as designated in a particular file or component or in included license
13 documentation. The authors of MySQL hereby grant you an additional
14 permission to link the program and your derivative works with the
15 separately licensed software that they have either included with
16 the program or referenced in the documentation.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License, version 2.0, for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
26
27/*
28 This file is based on public domain code from ftp://elsie.ncih.nist.gov/
29 Initial source code is in the public domain, so clarified as of
30 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
31*/
32
33/*
34 Information about time zone files.
35*/
36
37#ifndef TZDIR
38#define TZDIR "/usr/share/zoneinfo" /* Time zone object file directory */
39#endif /* !defined TZDIR */
40
41/*
42 Each file begins with. . .
43*/
44
45#define TZ_MAGIC "TZif"
46
47struct tzhead {
48 uchar tzh_magic[4]; /* TZ_MAGIC */
49 uchar tzh_reserved[16]; /* reserved for future use */
50 uchar tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */
51 uchar tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
52 uchar tzh_leapcnt[4]; /* coded number of leap seconds */
53 uchar tzh_timecnt[4]; /* coded number of transition times */
54 uchar tzh_typecnt[4]; /* coded number of local time types */
55 uchar tzh_charcnt[4]; /* coded number of abbr. chars */
56};
57
58/*
59 . . .followed by. . .
60
61 tzh_timecnt (char [4])s coded transition times a la time(2)
62 tzh_timecnt (unsigned char)s types of local time starting at above
63 tzh_typecnt repetitions of
64 one (char [4]) coded UTC offset in seconds
65 one (unsigned char) used to set tm_isdst
66 one (unsigned char) that's an abbreviation list index
67 tzh_charcnt (char)s '\0'-terminated zone abbreviations
68 tzh_leapcnt repetitions of
69 one (char [4]) coded leap second transition times
70 one (char [4]) total correction after above
71 tzh_ttisstdcnt (char)s indexed by type; if true, transition
72 time is standard time, if false,
73 transition time is wall clock time
74 if absent, transition times are
75 assumed to be wall clock time
76 tzh_ttisgmtcnt (char)s indexed by type; if true, transition
77 time is UTC, if false,
78 transition time is local time
79 if absent, transition times are
80 assumed to be local time
81*/
82
83/*
84 In the current implementation, we refuse to deal with files that
85 exceed any of the limits below.
86*/
87
88#ifndef TZ_MAX_TIMES
89/*
90 The TZ_MAX_TIMES value below is enough to handle a bit more than a
91 year's worth of solar time (corrected daily to the nearest second) or
92 138 years of Pacific Presidential Election time
93 (where there are three time zone transitions every fourth year).
94*/
95#define TZ_MAX_TIMES 370
96#endif /* !defined TZ_MAX_TIMES */
97
98#ifndef TZ_MAX_TYPES
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 TZ_MAX_TYPES */
105
106#ifndef TZ_MAX_CHARS
107#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */
108 /* (limited by what unsigned chars can hold) */
109#endif /* !defined TZ_MAX_CHARS */
110
111#ifndef TZ_MAX_LEAPS
112#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */
113#endif /* !defined TZ_MAX_LEAPS */
114
115#ifndef TZ_MAX_REV_RANGES
116#define TZ_MAX_REV_RANGES (TZ_MAX_TIMES + TZ_MAX_LEAPS + 2)
117#endif
118
119#define TM_YEAR_BASE 1900
120
121#define EPOCH_YEAR 1970
122
123/*
124 Accurate only for the past couple of centuries,
125 that will probably do.
126*/
127
128#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
129
130#endif
unsigned char uchar
Definition: my_inttypes.h:52
Definition: tzfile.h:47
uchar tzh_ttisgmtcnt[4]
Definition: tzfile.h:50
uchar tzh_leapcnt[4]
Definition: tzfile.h:52
uchar tzh_timecnt[4]
Definition: tzfile.h:53
uchar tzh_reserved[16]
Definition: tzfile.h:49
uchar tzh_magic[4]
Definition: tzfile.h:48
uchar tzh_charcnt[4]
Definition: tzfile.h:55
uchar tzh_typecnt[4]
Definition: tzfile.h:54
uchar tzh_ttisstdcnt[4]
Definition: tzfile.h:51