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