-
Notifications
You must be signed in to change notification settings - Fork 14
/
zones.c
303 lines (299 loc) · 17.3 KB
/
zones.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
#include "utz.h"
const urule_packed_t zone_rules[50] = {
{ 8, 255, 7, 1, 1, 2, 0, 1, 4, 0}, // AN 2008 max - Apr Sun>=1 2:00s 0 S
{ 8, 255, 7, 1, 1, 2, 0, 2, 10, 1}, // AN 2008 max - Oct Sun>=1 2:00s 1:00 D
{ 8, 255, 7, 1, 1, 2, 0, 1, 4, 0}, // AS 2008 max - Apr Sun>=1 2:00s 0 S
{ 8, 255, 7, 1, 1, 2, 0, 2, 10, 1}, // AS 2008 max - Oct Sun>=1 2:00s 1:00 D
{ 8, 255, 7, 1, 1, 2, 0, 1, 4, 0}, // AT 2008 max - Apr Sun>=1 2:00s 0 S
{ 1, 255, 7, 1, 1, 2, 0, 2, 10, 1}, // AT 2001 max - Oct Sun>=1 2:00s 1:00 D
{ 16, 22, 6, 14, 1, 23, 0, 0, 2, 0}, // Brazil 2016 2022 - Feb Sun>=15 0:00 0 -
{ 23, 23, 6, 21, 1, 23, 0, 0, 2, 0}, // Brazil 2023 only - Feb Sun>=22 0:00 0 -
{ 24, 25, 6, 14, 1, 23, 0, 0, 2, 0}, // Brazil 2024 2025 - Feb Sun>=15 0:00 0 -
{ 26, 26, 6, 21, 1, 23, 0, 0, 2, 0}, // Brazil 2026 only - Feb Sun>=22 0:00 0 -
{ 27, 33, 6, 14, 1, 23, 0, 0, 2, 0}, // Brazil 2027 2033 - Feb Sun>=15 0:00 0 -
{ 34, 34, 6, 21, 1, 23, 0, 0, 2, 0}, // Brazil 2034 only - Feb Sun>=22 0:00 0 -
{ 35, 36, 6, 14, 1, 23, 0, 0, 2, 0}, // Brazil 2035 2036 - Feb Sun>=15 0:00 0 -
{ 37, 37, 6, 21, 1, 23, 0, 0, 2, 0}, // Brazil 2037 only - Feb Sun>=22 0:00 0 -
{ 38, 255, 6, 14, 1, 23, 0, 0, 2, 0}, // Brazil 2038 max - Feb Sun>=15 0:00 0 -
{ 8, 255, 7, 15, 1, 0, 0, 1, 10, 1}, // Brazil 2008 max - Oct Sun>=15 0:00 1:00 S
{ 7, 255, 7, 8, 1, 2, 0, 2, 3, 1}, // Canada 2007 max - Mar Sun>=8 2:00 1:00 D
{ 7, 255, 7, 1, 1, 1, 0, 1, 11, 0}, // Canada 2007 max - Nov Sun>=1 2:00 0 S
{ 16, 255, 7, 9, 0, 3, 0, 0, 5, 0}, // Chile 2016 max - May Sun>=9 3:00u 0 -
{ 16, 255, 7, 9, 0, 4, 0, 1, 8, 1}, // Chile 2016 max - Aug Sun>=9 4:00u 1:00 S
{ 0, 255, 7, 0, 0, 1, 0, 1, 3, 1}, // EU 1981 max - Mar lastSun 1:00u 1:00 S
{ 0, 255, 7, 0, 0, 1, 0, 0, 10, 0}, // EU 1996 max - Oct lastSun 1:00u 0 -
{ 17, 19, 0, 22, 1, 0, 0, 2, 3, 1}, // Iran 2017 2019 - Mar 22 0:00 1:00 D
{ 20, 20, 0, 21, 1, 0, 0, 2, 3, 1}, // Iran 2020 only - Mar 21 0:00 1:00 D
{ 21, 23, 0, 22, 1, 0, 0, 2, 3, 1}, // Iran 2021 2023 - Mar 22 0:00 1:00 D
{ 24, 24, 0, 21, 1, 0, 0, 2, 3, 1}, // Iran 2024 only - Mar 21 0:00 1:00 D
{ 25, 27, 0, 22, 1, 0, 0, 2, 3, 1}, // Iran 2025 2027 - Mar 22 0:00 1:00 D
{ 28, 29, 0, 21, 1, 0, 0, 2, 3, 1}, // Iran 2028 2029 - Mar 21 0:00 1:00 D
{ 30, 31, 0, 22, 1, 0, 0, 2, 3, 1}, // Iran 2030 2031 - Mar 22 0:00 1:00 D
{ 32, 33, 0, 21, 1, 0, 0, 2, 3, 1}, // Iran 2032 2033 - Mar 21 0:00 1:00 D
{ 34, 35, 0, 22, 1, 0, 0, 2, 3, 1}, // Iran 2034 2035 - Mar 22 0:00 1:00 D
{ 36, 255, 0, 21, 1, 0, 0, 2, 3, 1}, // Iran 2036 max - Mar 21 0:00 1:00 D
{ 17, 19, 0, 21, 1, 23, 0, 1, 9, 0}, // Iran 2017 2019 - Sep 22 0:00 0 S
{ 20, 20, 0, 20, 1, 23, 0, 1, 9, 0}, // Iran 2020 only - Sep 21 0:00 0 S
{ 21, 23, 0, 21, 1, 23, 0, 1, 9, 0}, // Iran 2021 2023 - Sep 22 0:00 0 S
{ 24, 24, 0, 20, 1, 23, 0, 1, 9, 0}, // Iran 2024 only - Sep 21 0:00 0 S
{ 25, 27, 0, 21, 1, 23, 0, 1, 9, 0}, // Iran 2025 2027 - Sep 22 0:00 0 S
{ 28, 29, 0, 20, 1, 23, 0, 1, 9, 0}, // Iran 2028 2029 - Sep 21 0:00 0 S
{ 30, 31, 0, 21, 1, 23, 0, 1, 9, 0}, // Iran 2030 2031 - Sep 22 0:00 0 S
{ 32, 33, 0, 20, 1, 23, 0, 1, 9, 0}, // Iran 2032 2033 - Sep 21 0:00 0 S
{ 34, 35, 0, 21, 1, 23, 0, 1, 9, 0}, // Iran 2034 2035 - Sep 22 0:00 0 S
{ 36, 255, 0, 20, 1, 23, 0, 1, 9, 0}, // Iran 2036 max - Sep 21 0:00 0 S
{ 2, 255, 7, 1, 1, 2, 0, 2, 4, 1}, // Mexico 2002 max - Apr Sun>=1 2:00 1:00 D
{ 2, 255, 7, 0, 1, 1, 0, 1, 10, 0}, // Mexico 2002 max - Oct lastSun 2:00 0 S
{ 8, 255, 7, 1, 1, 2, 0, 1, 4, 0}, // NZ 2008 max - Apr Sun>=1 2:00s 0 S
{ 7, 255, 7, 0, 1, 2, 0, 2, 9, 1}, // NZ 2007 max - Sep lastSun 2:00s 1:00 D
{ 7, 255, 7, 8, 1, 2, 0, 2, 3, 1}, // US 2007 max - Mar Sun>=8 2:00 1:00 D
{ 7, 255, 7, 1, 1, 1, 0, 1, 11, 0}, // US 2007 max - Nov Sun>=1 2:00 0 S
{ 13, 255, 5, 23, 1, 2, 0, 2, 3, 1}, // Zion 2013 max - Mar Fri>=23 2:00 1:00 D
{ 13, 255, 7, 0, 1, 1, 0, 1, 10, 0}, // Zion 2013 max - Oct lastSun 2:00 0 S
};
const char zone_abrevs[209] = {
'E','E','S','T','\0',
'W','A','T','\0',
'C','A','T','\0',
'E','A','T','\0',
'A','K','%','c','T','\0',
'A','R','S','T','\0',
'C','%','c','T','\0',
'M','%','c','T','\0',
'A','%','c','T','\0',
'P','%','c','T','\0',
'A','M','T','\0',
'E','%','c','T','\0',
'M','S','T','\0',
'C','S','T','\0',
'C','L','%','c','T','\0',
'B','R','%','c','T','\0',
'N','%','c','T','\0',
'I','C','T','\0',
'G','S','T','\0',
'H','K','S','T','\0',
'I','%','c','T','\0',
'P','K','S','T','\0',
'N','P','T','\0',
'I','S','T','\0',
'A','S','T','\0',
'K','S','T','\0',
'I','R','%','c','T','\0',
'J','S','T','\0',
'M','M','T','\0',
'A','C','%','c','T','\0',
'A','E','S','T','\0',
'A','C','S','T','\0',
'A','E','%','c','T','\0',
'A','W','S','T','\0',
'C','E','%','c','T','\0',
'E','E','%','c','T','\0',
'+','0','3','\0',
'G','M','T','/','B','S','T','\0',
'M','S','K','\0',
'N','Z','%','c','T','\0',
'C','h','S','T','\0',
'H','S','T','\0',
'S','S','T','\0',
};
const uzone_packed_t zone_defns[46] = {
// Africa/Cairo 2:00 Egypt EE%sT
{ 8, 0, 0, 0},
// Africa/Lagos 1:00 - WAT
{ 4, 0, 0, 5},
// Africa/Maputo 2:00 - CAT
{ 8, 0, 0, 9},
// Africa/Nairobi 3:00 - EAT
{ 12, 0, 0, 13},
// America/Anchorage -9:00 US AK%sT
{-36, 46, 2, 17},
// America/Argentina/Buenos_Aires -3:00 Arg AR%sT
{-12, 0, 0, 23},
// America/Chicago -6:00 US C%sT
{-24, 46, 2, 28},
// America/Denver -7:00 US M%sT
{-28, 46, 2, 33},
// America/Halifax -4:00 Canada A%sT
{-16, 16, 2, 38},
// America/Los_Angeles -8:00 US P%sT
// America/Tijuana -8:00 US P%sT
{-32, 46, 2, 43},
// America/Manaus -4:00 - AMT
{-16, 0, 0, 48},
// America/Mexico_City -6:00 Mexico C%sT
{-24, 42, 2, 28},
// America/New_York -5:00 US E%sT
{-20, 46, 2, 52},
// America/Phoenix -7:00 - MST
{-28, 0, 0, 57},
// America/Regina -6:00 - CST
{-24, 0, 0, 61},
// America/Santiago -4:00 Chile CL%sT
{-16, 18, 2, 65},
// America/Sao_Paulo -3:00 Brazil BR%sT
{-12, 6, 10, 71},
// America/St_Johns -3:30 Canada N%sT
{-10, 16, 2, 77},
// Asia/Bangkok 7:00 - ICT
{ 28, 0, 0, 82},
// Asia/Dubai 4:00 - GST
{ 16, 0, 0, 86},
// Asia/Hong_Kong 8:00 HK HK%sT
{ 32, 0, 0, 90},
// Asia/Jerusalem 2:00 Zion I%sT
{ 8, 48, 2, 95},
// Asia/Karachi 5:00 Pakistan PK%sT
{ 20, 0, 0, 100},
// Asia/Kathmandu 5:45 - NPT
{ 23, 0, 0, 105},
// Asia/Kolkata 5:30 - IST
{ 22, 0, 0, 109},
// Asia/Riyadh 3:00 - AST
{ 12, 0, 0, 113},
// Asia/Seoul 9:00 ROK K%sT
{ 36, 0, 0, 117},
// Asia/Shanghai 8:00 PRC C%sT
// Asia/Taipei 8:00 Taiwan C%sT
{ 32, 0, 0, 61},
// Asia/Tehran 3:30 Iran IR%sT
{ 14, 22, 20, 121},
// Asia/Tokyo 9:00 Japan J%sT
{ 36, 0, 0, 127},
// Asia/Yangon 6:30 - MMT
{ 26, 0, 0, 131},
// Australia/Adelaide 9:30 AS AC%sT
{ 38, 2, 2, 135},
// Australia/Brisbane 10:00 AQ AE%sT
{ 40, 0, 0, 141},
// Australia/Darwin 9:30 Aus AC%sT
{ 38, 0, 0, 146},
// Australia/Hobart 10:00 AT AE%sT
{ 40, 4, 2, 151},
// Australia/Perth 8:00 AW AW%sT
{ 32, 0, 0, 157},
// Australia/Sydney 10:00 AN AE%sT
{ 40, 0, 2, 151},
// Europe/Belgrade 1:00 EU CE%sT
// Europe/Berlin 1:00 EU CE%sT
// Europe/Madrid 1:00 EU CE%sT
// Europe/Rome 1:00 EU CE%sT
{ 4, 20, 2, 162},
// Europe/Helsinki 2:00 EU EE%sT
{ 8, 20, 2, 168},
// Europe/Istanbul 3:00 - +03
{ 12, 0, 0, 174},
// Europe/London 0:00 EU GMT/BST
{ 0, 20, 2, 178},
// Europe/Moscow 3:00 - MSK
{ 12, 0, 0, 186},
// Pacific/Auckland 12:00 NZ NZ%sT
{ 48, 44, 2, 190},
// Pacific/Guam 10:00 - ChST
{ 40, 0, 0, 196},
// Pacific/Honolulu -10:00 - HST
{-40, 0, 0, 201},
// Pacific/Pago_Pago -11:00 - SST
{-44, 0, 0, 205},
};
const unsigned char zone_names[961] = {
'A','d','e','l','a','i','d','e','\0', 31, // Adelaide
'A','h','m','e','d','a','b','a','d','\0', 24, // Ahmedabad
'A','n','c','h','o','r','a','g','e','\0', 4, // Anchorage
'A','n','k','a','r','a','\0', 39, // Ankara
'A','t','l','a','n','t','a','\0', 12, // Atlanta
'A','u','c','k','l','a','n','d','\0', 42, // Auckland
'B','a','n','g','a','l','o','r','e','\0', 24, // Bangalore
'B','a','n','g','k','o','k','\0', 18, // Bangkok
'B','a','r','c','e','l','o','n','a','\0', 37, // Barcelona
'B','e','i','j','i','n','g','\0', 27, // Beijing
'B','e','l','g','r','a','d','e','\0', 37, // Belgrade
'B','e','l','o',' ','H','o','r','i','z','o','n','t','e','\0', 16, // Belo Horizonte
'B','e','r','l','i','n','\0', 37, // Berlin
'B','o','s','t','o','n','\0', 12, // Boston
'B','r','a','z','z','a','v','i','l','l','e','\0', 1, // Brazzaville
'B','r','i','s','b','a','n','e','\0', 32, // Brisbane
'B','u','e','n','o','s',' ','A','i','r','e','s','\0', 5, // Buenos Aires
'C','a','i','r','o','\0', 0, // Cairo
'C','a','l','c','u','t','t','a','\0', 24, // Calcutta
'C','h','a','n','g','z','h','o','u','\0', 27, // Changzhou
'C','h','e','n','g','d','u','\0', 27, // Chengdu
'C','h','e','n','n','a','i','\0', 24, // Chennai
'C','h','i','c','a','g','o','\0', 6, // Chicago
'C','h','o','n','g','q','i','n','g','\0', 27, // Chongqing
'D','a','l','l','a','s','F','o','r','t',' ','W','o','r','t','h','\0', 6, // DallasFort Worth
'D','a','r','w','i','n','\0', 33, // Darwin
'D','e','l','h','i','\0', 24, // Delhi
'D','e','n','v','e','r','\0', 7, // Denver
'D','u','b','a','i','\0', 19, // Dubai
'G','u','a','d','a','l','a','j','a','r','a','\0', 11, // Guadalajara
'G','u','a','m','\0', 43, // Guam
'G','u','a','n','g','z','h','o','u','\0', 27, // Guangzhou
'H','a','l','i','f','a','x','\0', 8, // Halifax
'H','a','m','b','u','r','g','\0', 37, // Hamburg
'H','a','n','g','z','h','o','u','\0', 27, // Hangzhou
'H','a','r','a','r','e','\0', 2, // Harare
'H','e','l','s','i','n','k','i','\0', 38, // Helsinki
'H','o','b','a','r','t','\0', 34, // Hobart
'H','o','n','g',' ','K','o','n','g','\0', 20, // Hong Kong
'H','o','n','o','l','u','l','u','\0', 44, // Honolulu
'H','o','u','s','t','o','n','\0', 6, // Houston
'H','y','d','e','r','a','b','a','d','\0', 24, // Hyderabad
'I','n','l','a','n','d',' ','E','m','p','i','r','e','\0', 9, // Inland Empire
'I','s','t','a','n','b','u','l','\0', 39, // Istanbul
'J','e','r','u','s','a','l','e','m','\0', 21, // Jerusalem
'J','i','n','a','n','\0', 27, // Jinan
'K','a','r','a','c','h','i','\0', 22, // Karachi
'K','a','t','m','a','n','d','u','\0', 23, // Katmandu
'K','o','l','k','a','t','a','\0', 24, // Kolkata
'K','u','w','a','i','t','\0', 25, // Kuwait
'L','a','h','o','r','e','\0', 22, // Lahore
'L','o','n','d','o','n','\0', 40, // London
'L','o','s',' ','A','n','g','e','l','e','s','\0', 9, // Los Angeles
'M','a','d','r','i','d','\0', 37, // Madrid
'M','a','n','a','u','s','\0', 10, // Manaus
'M','e','x','i','c','o',' ','C','i','t','y','\0', 11, // Mexico City
'M','i','a','m','i','\0', 12, // Miami
'M','i','d','w','a','y','\0', 45, // Midway
'M','i','l','a','n','\0', 37, // Milan
'M','o','s','c','o','w','\0', 41, // Moscow
'M','u','m','b','a','i','\0', 24, // Mumbai
'M','u','n','i','c','h','\0', 37, // Munich
'N','a','g','o','y','a','\0', 29, // Nagoya
'N','a','i','r','o','b','i','\0', 3, // Nairobi
'N','a','n','c','h','a','n','g','\0', 27, // Nanchang
'N','a','n','j','i','n','g','\0', 27, // Nanjing
'N','e','w',' ','Y','o','r','k','\0', 12, // New York
'O','s','a','k','a','\0', 29, // Osaka
'P','e','r','t','h','\0', 35, // Perth
'P','h','i','l','a','d','e','l','p','h','i','a','\0', 12, // Philadelphia
'P','h','o','e','n','i','x','\0', 13, // Phoenix
'P','u','n','e','\0', 24, // Pune
'Q','i','n','g','d','a','o','\0', 27, // Qingdao
'R','a','n','g','o','o','n','\0', 30, // Rangoon
'R','e','g','i','n','a','\0', 14, // Regina
'R','h','i','n','e','-','R','u','h','r','\0', 37, // Rhine-Ruhr
'R','i','o',' ','d','e',' ','J','a','n','e','i','r','o','\0', 16, // Rio de Janeiro
'R','o','m','e','\0', 37, // Rome
'S','a','n',' ','F','r','a','n','c','i','s','c','o','\0', 9, // San Francisco
'S','a','n','t','i','a','g','o','\0', 15, // Santiago
'S','a','o',' ','P','a','u','l','o','\0', 16, // Sao Paulo
'S','a','r','a','j','e','v','o','\0', 37, // Sarajevo
'S','e','o','u','l','\0', 26, // Seoul
'S','h','a','n','g','h','a','i','\0', 27, // Shanghai
'S','h','e','n','y','a','n','g','\0', 27, // Shenyang
'S','h','e','n','z','h','e','n','\0', 27, // Shenzhen
'S','t',' ','J','o','h','n','s','\0', 17, // St Johns
'S','t','u','t','t','g','a','r','t','\0', 37, // Stuttgart
'S','u','r','a','t','\0', 24, // Surat
'S','y','d','n','e','y','\0', 36, // Sydney
'T','a','i','p','e','i','\0', 27, // Taipei
'T','e','h','r','a','n','\0', 28, // Tehran
'T','i','a','n','j','i','n','\0', 27, // Tianjin
'T','i','j','u','a','n','a','\0', 9, // Tijuana
'T','o','k','y','o','\0', 29, // Tokyo
'W','a','s','h','i','n','g','t','o','n',',',' ','D','.','C','.','\0', 12, // Washington, D.C.
'W','e','n','z','h','o','u','\0', 27, // Wenzhou
'W','u','h','a','n','\0', 27, // Wuhan
'X','i','\'','a','n','\0', 27, // Xi'an
'Z','h','e','n','g','z','h','o','u','\0', 27, // Zhengzhou
};