PostgreSQL Source Code git master
Loading...
Searching...
No Matches
tzfile.h
Go to the documentation of this file.
1/* Layout and location of TZif files. */
2
3#ifndef TZFILE_H
4
5#define TZFILE_H
6
7/*
8 * This file is in the public domain, so clarified as of
9 * 1996-06-05 by Arthur David Olson.
10 *
11 * IDENTIFICATION
12 * src/timezone/tzfile.h
13 */
14
15/*
16 * This header is for use ONLY with the time conversion code.
17 * There is no guarantee that it will remain unchanged,
18 * or that it will remain at all.
19 * Do NOT copy it to any system include directory.
20 * Thank you!
21 */
22
23/*
24 * Information about time zone files.
25 * See Internet RFC 9636 for more details about the following format.
26 */
27
28/*
29 * Each file begins with. . .
30 */
31
32#define TZ_MAGIC "TZif"
33
34struct tzhead
35{
36 char tzh_magic[4]; /* TZ_MAGIC */
37 char tzh_version[1]; /* '\0' or '2'-'4' as of 2021 */
38 char tzh_reserved[15]; /* reserved; must be zero */
39 char tzh_ttisutcnt[4]; /* coded number of trans. time flags */
40 char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
41 char tzh_leapcnt[4]; /* coded number of leap seconds */
42 char tzh_timecnt[4]; /* coded number of transition times */
43 char tzh_typecnt[4]; /* coded number of local time types */
44 char tzh_charcnt[4]; /* coded number of abbr. chars */
45};
46
47/*
48 * . . .followed by. . .
49 *
50 * tzh_timecnt (char [4])s coded transition times a la time(2)
51 * tzh_timecnt (unsigned char)s types of local time starting at above
52 * tzh_typecnt repetitions of
53 * one (char [4]) coded UT offset in seconds
54 * one (unsigned char) used to set tm_isdst
55 * one (unsigned char) that's an abbreviation list index
56 * tzh_charcnt (char)s '\0'-terminated zone abbreviations
57 * tzh_leapcnt repetitions of
58 * one (char [4]) coded leap second transition times
59 * one (char [4]) total correction after above
60 * tzh_ttisstdcnt (char)s indexed by type; if 1, transition
61 * time is standard time, if 0,
62 * transition time is local (wall clock)
63 * time; if absent, transition times are
64 * assumed to be local time
65 * tzh_ttisutcnt (char)s indexed by type; if 1, transition
66 * time is UT, if 0, transition time is
67 * local time; if absent, transition
68 * times are assumed to be local time.
69 * When this is 1, the corresponding
70 * std/wall indicator must also be 1.
71 */
72
73/*
74 * If tzh_version is '2' or greater, the above is followed by a second instance
75 * of tzhead and a second instance of the data in which each coded transition
76 * time uses 8 rather than 4 chars,
77 * then a POSIX.1-2017 proleptic TZ string for use in handling
78 * instants after the last transition time stored in the file
79 * (with nothing between the newlines if there is no POSIX.1-2017
80 * representation for such instants).
81 *
82 * If tz_version is '3' or greater, the TZ string can be any POSIX.1-2024
83 * proleptic TZ string, which means the above is extended as follows.
84 * First, the TZ string's hour offset may range from -167
85 * through 167 as compared to the range 0 through 24 required
86 * by POSIX.1-2017 and earlier.
87 * Second, its DST start time may be January 1 at 00:00 and its stop
88 * time December 31 at 24:00 plus the difference between DST and
89 * standard time, indicating DST all year.
90 */
91
92/*
93 * In the current implementation, "tzset()" refuses to deal with files that
94 * exceed any of the limits below.
95 */
96
97#ifndef TZ_MAX_TIMES
98/*
99 * The following limit applies to localtime.c; zic has no such limit.
100 * The limit must be at least 310 for Asia/Hebron with 'zic -b fat'.
101 */
102#define TZ_MAX_TIMES 2000
103#endif /* !defined TZ_MAX_TIMES */
104
105#ifndef TZ_MAX_TYPES
106/* This must be at least 18 for Europe/Vilnius with 'zic -b fat'. */
107#define TZ_MAX_TYPES 256 /* Limited to 256 by Internet RFC 9636. */
108#endif /* !defined TZ_MAX_TYPES */
109
110#ifndef TZ_MAX_CHARS
111/* This must be at least 40 for America/Anchorage. */
112#define TZ_MAX_CHARS 256 /* Maximum number of abbreviation characters */
113 /* (limited to 256 by Internet RFC 9636) */
114#endif /* !defined TZ_MAX_CHARS */
115
116#ifndef TZ_MAX_LEAPS
117/*
118 * The following limit applies to localtime.c; zic has no such limit.
119 * The limit must be at least 27 for leap seconds from 1972 through mid-2023.
120 * There's a plan to discontinue leap seconds by 2035.
121 */
122#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */
123#endif /* !defined TZ_MAX_LEAPS */
124
125#endif /* !defined TZFILE_H */
char tzh_timecnt[4]
Definition tzfile.h:42
char tzh_ttisstdcnt[4]
Definition tzfile.h:40
char tzh_version[1]
Definition tzfile.h:37
char tzh_charcnt[4]
Definition tzfile.h:44
char tzh_leapcnt[4]
Definition tzfile.h:41
char tzh_ttisutcnt[4]
Definition tzfile.h:39
char tzh_reserved[15]
Definition tzfile.h:38
char tzh_magic[4]
Definition tzfile.h:36
char tzh_typecnt[4]
Definition tzfile.h:43