1 | /* |
2 | Copyright (C) 2002-2004 MySQL AB |
3 | |
4 | This program is free software; you can redistribute it and/or modify |
5 | it under the terms of version 2 of the GNU General Public License as |
6 | published by the Free Software Foundation. |
7 | |
8 | There are special exceptions to the terms and conditions of the GPL |
9 | as it is applied to this software. View the full text of the |
10 | exception in file EXCEPTIONS-CONNECTOR-J in the directory of this |
11 | software distribution. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 | |
22 | |
23 | |
24 | */ |
25 | package com.mysql.jdbc; |
26 | |
27 | import java.sql.Date; |
28 | import java.sql.Time; |
29 | import java.sql.Timestamp; |
30 | |
31 | import java.util.Calendar; |
32 | import java.util.Collections; |
33 | import java.util.GregorianCalendar; |
34 | import java.util.HashMap; |
35 | import java.util.Locale; |
36 | import java.util.Map; |
37 | import java.util.TimeZone; |
38 | |
39 | /** |
40 | * Timezone conversion routines |
41 | * |
42 | * @author Mark Matthews |
43 | */ |
44 | public class TimeUtil { |
45 | static final Map ABBREVIATED_TIMEZONES; |
46 | |
47 | static final TimeZone GMT_TIMEZONE = TimeZone.getTimeZone("GMT"); |
48 | |
49 | static final Map TIMEZONE_MAPPINGS; |
50 | |
51 | static { |
52 | HashMap tempMap = new HashMap(); |
53 | |
54 | // |
55 | // Windows Mappings |
56 | // |
57 | tempMap.put("Romance", "Europe/Paris"); |
58 | tempMap.put("Romance Standard Time", "Europe/Paris"); |
59 | tempMap.put("Warsaw", "Europe/Warsaw"); |
60 | tempMap.put("Central Europe", "Europe/Prague"); |
61 | tempMap.put("Central Europe Standard Time", "Europe/Prague"); |
62 | tempMap.put("Prague Bratislava", "Europe/Prague"); |
63 | tempMap.put("W. Central Africa Standard Time", "Africa/Luanda"); |
64 | tempMap.put("FLE", "Europe/Helsinki"); |
65 | tempMap.put("FLE Standard Time", "Europe/Helsinki"); |
66 | tempMap.put("GFT", "Europe/Athens"); |
67 | tempMap.put("GFT Standard Time", "Europe/Athens"); |
68 | tempMap.put("GTB", "Europe/Athens"); |
69 | tempMap.put("GTB Standard Time", "Europe/Athens"); |
70 | tempMap.put("Israel", "Asia/Jerusalem"); |
71 | tempMap.put("Israel Standard Time", "Asia/Jerusalem"); |
72 | tempMap.put("Arab", "Asia/Riyadh"); |
73 | tempMap.put("Arab Standard Time", "Asia/Riyadh"); |
74 | tempMap.put("Arabic Standard Time", "Asia/Baghdad"); |
75 | tempMap.put("E. Africa", "Africa/Nairobi"); |
76 | tempMap.put("E. Africa Standard Time", "Africa/Nairobi"); |
77 | tempMap.put("Saudi Arabia", "Asia/Riyadh"); |
78 | tempMap.put("Saudi Arabia Standard Time", "Asia/Riyadh"); |
79 | tempMap.put("Iran", "Asia/Tehran"); |
80 | tempMap.put("Iran Standard Time", "Asia/Tehran"); |
81 | tempMap.put("Afghanistan", "Asia/Kabul"); |
82 | tempMap.put("Afghanistan Standard Time", "Asia/Kabul"); |
83 | tempMap.put("India", "Asia/Calcutta"); |
84 | tempMap.put("India Standard Time", "Asia/Calcutta"); |
85 | tempMap.put("Myanmar Standard Time", "Asia/Rangoon"); |
86 | tempMap.put("Nepal Standard Time", "Asia/Katmandu"); |
87 | tempMap.put("Sri Lanka", "Asia/Colombo"); |
88 | tempMap.put("Sri Lanka Standard Time", "Asia/Colombo"); |
89 | tempMap.put("Beijing", "Asia/Shanghai"); |
90 | tempMap.put("China", "Asia/Shanghai"); |
91 | tempMap.put("China Standard Time", "Asia/Shanghai"); |
92 | tempMap.put("AUS Central", "Australia/Darwin"); |
93 | tempMap.put("AUS Central Standard Time", "Australia/Darwin"); |
94 | tempMap.put("Cen. Australia", "Australia/Adelaide"); |
95 | tempMap.put("Cen. Australia Standard Time", "Australia/Adelaide"); |
96 | tempMap.put("Vladivostok", "Asia/Vladivostok"); |
97 | tempMap.put("Vladivostok Standard Time", "Asia/Vladivostok"); |
98 | tempMap.put("West Pacific", "Pacific/Guam"); |
99 | tempMap.put("West Pacific Standard Time", "Pacific/Guam"); |
100 | tempMap.put("E. South America", "America/Sao_Paulo"); |
101 | tempMap.put("E. South America Standard Time", "America/Sao_Paulo"); |
102 | tempMap.put("Greenland Standard Time", "America/Godthab"); |
103 | tempMap.put("Newfoundland", "America/St_Johns"); |
104 | tempMap.put("Newfoundland Standard Time", "America/St_Johns"); |
105 | tempMap.put("Pacific SA", "America/Caracas"); |
106 | tempMap.put("Pacific SA Standard Time", "America/Caracas"); |
107 | tempMap.put("SA Western", "America/Caracas"); |
108 | tempMap.put("SA Western Standard Time", "America/Caracas"); |
109 | tempMap.put("SA Pacific", "America/Bogota"); |
110 | tempMap.put("SA Pacific Standard Time", "America/Bogota"); |
111 | tempMap.put("US Eastern", "America/Indianapolis"); |
112 | tempMap.put("US Eastern Standard Time", "America/Indianapolis"); |
113 | tempMap.put("Central America Standard Time", "America/Regina"); |
114 | tempMap.put("Mexico", "America/Mexico_City"); |
115 | tempMap.put("Mexico Standard Time", "America/Mexico_City"); |
116 | tempMap.put("Canada Central", "America/Regina"); |
117 | tempMap.put("Canada Central Standard Time", "America/Regina"); |
118 | tempMap.put("US Mountain", "America/Phoenix"); |
119 | tempMap.put("US Mountain Standard Time", "America/Phoenix"); |
120 | tempMap.put("GMT", "Europe/London"); |
121 | tempMap.put("GMT Standard Time", "Europe/London"); |
122 | tempMap.put("Ekaterinburg", "Asia/Yekaterinburg"); |
123 | tempMap.put("Ekaterinburg Standard Time", "Asia/Yekaterinburg"); |
124 | tempMap.put("West Asia", "Asia/Karachi"); |
125 | tempMap.put("West Asia Standard Time", "Asia/Karachi"); |
126 | tempMap.put("Central Asia", "Asia/Dhaka"); |
127 | tempMap.put("Central Asia Standard Time", "Asia/Dhaka"); |
128 | tempMap.put("N. Central Asia Standard Time", "Asia/Novosibirsk"); |
129 | tempMap.put("Bangkok", "Asia/Bangkok"); |
130 | tempMap.put("Bangkok Standard Time", "Asia/Bangkok"); |
131 | tempMap.put("North Asia Standard Time", "Asia/Krasnoyarsk"); |
132 | tempMap.put("SE Asia", "Asia/Bangkok"); |
133 | tempMap.put("SE Asia Standard Time", "Asia/Bangkok"); |
134 | tempMap.put("North Asia East Standard Time", "Asia/Ulaanbaatar"); |
135 | tempMap.put("Singapore", "Asia/Singapore"); |
136 | tempMap.put("Singapore Standard Time", "Asia/Singapore"); |
137 | tempMap.put("Taipei", "Asia/Taipei"); |
138 | tempMap.put("Taipei Standard Time", "Asia/Taipei"); |
139 | tempMap.put("W. Australia", "Australia/Perth"); |
140 | tempMap.put("W. Australia Standard Time", "Australia/Perth"); |
141 | tempMap.put("Korea", "Asia/Seoul"); |
142 | tempMap.put("Korea Standard Time", "Asia/Seoul"); |
143 | tempMap.put("Tokyo", "Asia/Tokyo"); |
144 | tempMap.put("Tokyo Standard Time", "Asia/Tokyo"); |
145 | tempMap.put("Yakutsk", "Asia/Yakutsk"); |
146 | tempMap.put("Yakutsk Standard Time", "Asia/Yakutsk"); |
147 | tempMap.put("Central European", "Europe/Belgrade"); |
148 | tempMap.put("Central European Standard Time", "Europe/Belgrade"); |
149 | tempMap.put("W. Europe", "Europe/Berlin"); |
150 | tempMap.put("W. Europe Standard Time", "Europe/Berlin"); |
151 | tempMap.put("Tasmania", "Australia/Hobart"); |
152 | tempMap.put("Tasmania Standard Time", "Australia/Hobart"); |
153 | tempMap.put("AUS Eastern", "Australia/Sydney"); |
154 | tempMap.put("AUS Eastern Standard Time", "Australia/Sydney"); |
155 | tempMap.put("E. Australia", "Australia/Brisbane"); |
156 | tempMap.put("E. Australia Standard Time", "Australia/Brisbane"); |
157 | tempMap.put("Sydney Standard Time", "Australia/Sydney"); |
158 | tempMap.put("Central Pacific", "Pacific/Guadalcanal"); |
159 | tempMap.put("Central Pacific Standard Time", "Pacific/Guadalcanal"); |
160 | tempMap.put("Dateline", "Pacific/Majuro"); |
161 | tempMap.put("Dateline Standard Time", "Pacific/Majuro"); |
162 | tempMap.put("Fiji", "Pacific/Fiji"); |
163 | tempMap.put("Fiji Standard Time", "Pacific/Fiji"); |
164 | tempMap.put("Samoa", "Pacific/Apia"); |
165 | tempMap.put("Samoa Standard Time", "Pacific/Apia"); |
166 | tempMap.put("Hawaiian", "Pacific/Honolulu"); |
167 | tempMap.put("Hawaiian Standard Time", "Pacific/Honolulu"); |
168 | tempMap.put("Alaskan", "America/Anchorage"); |
169 | tempMap.put("Alaskan Standard Time", "America/Anchorage"); |
170 | tempMap.put("Pacific", "America/Los_Angeles"); |
171 | tempMap.put("Pacific Standard Time", "America/Los_Angeles"); |
172 | tempMap.put("Mexico Standard Time 2", "America/Chihuahua"); |
173 | tempMap.put("Mountain", "America/Denver"); |
174 | tempMap.put("Mountain Standard Time", "America/Denver"); |
175 | tempMap.put("Central", "America/Chicago"); |
176 | tempMap.put("Central Standard Time", "America/Chicago"); |
177 | tempMap.put("Eastern", "America/New_York"); |
178 | tempMap.put("Eastern Standard Time", "America/New_York"); |
179 | tempMap.put("E. Europe", "Europe/Bucharest"); |
180 | tempMap.put("E. Europe Standard Time", "Europe/Bucharest"); |
181 | tempMap.put("Egypt", "Africa/Cairo"); |
182 | tempMap.put("Egypt Standard Time", "Africa/Cairo"); |
183 | tempMap.put("South Africa", "Africa/Harare"); |
184 | tempMap.put("South Africa Standard Time", "Africa/Harare"); |
185 | tempMap.put("Atlantic", "America/Halifax"); |
186 | tempMap.put("Atlantic Standard Time", "America/Halifax"); |
187 | tempMap.put("SA Eastern", "America/Buenos_Aires"); |
188 | tempMap.put("SA Eastern Standard Time", "America/Buenos_Aires"); |
189 | tempMap.put("Mid-Atlantic", "Atlantic/South_Georgia"); |
190 | tempMap.put("Mid-Atlantic Standard Time", "Atlantic/South_Georgia"); |
191 | tempMap.put("Azores", "Atlantic/Azores"); |
192 | tempMap.put("Azores Standard Time", "Atlantic/Azores"); |
193 | tempMap.put("Cape Verde Standard Time", "Atlantic/Cape_Verde"); |
194 | tempMap.put("Russian", "Europe/Moscow"); |
195 | tempMap.put("Russian Standard Time", "Europe/Moscow"); |
196 | tempMap.put("New Zealand", "Pacific/Auckland"); |
197 | tempMap.put("New Zealand Standard Time", "Pacific/Auckland"); |
198 | tempMap.put("Tonga Standard Time", "Pacific/Tongatapu"); |
199 | tempMap.put("Arabian", "Asia/Muscat"); |
200 | tempMap.put("Arabian Standard Time", "Asia/Muscat"); |
201 | tempMap.put("Caucasus", "Asia/Tbilisi"); |
202 | tempMap.put("Caucasus Standard Time", "Asia/Tbilisi"); |
203 | tempMap.put("GMT Standard Time", "GMT"); |
204 | tempMap.put("Greenwich", "GMT"); |
205 | tempMap.put("Greenwich Standard Time", "GMT"); |
206 | tempMap.put("UTC", "GMT"); |
207 | |
208 | TIMEZONE_MAPPINGS = Collections.unmodifiableMap(tempMap); |
209 | |
210 | // |
211 | // Handle abbreviated mappings |
212 | // |
213 | tempMap = new HashMap(); |
214 | |
215 | tempMap.put("ACST", new String[] { "America/Porto_Acre" }); |
216 | tempMap.put("ACT", new String[] { "America/Porto_Acre" }); |
217 | tempMap.put("ADDT", new String[] { "America/Pangnirtung" }); |
218 | tempMap.put("ADMT", new String[] { "Africa/Asmera", |
219 | "Africa/Addis_Ababa" }); |
220 | tempMap.put("ADT", new String[] { "Atlantic/Bermuda", "Asia/Baghdad", |
221 | "America/Thule", "America/Goose_Bay", "America/Halifax", |
222 | "America/Glace_Bay", "America/Pangnirtung", "America/Barbados", |
223 | "America/Martinique" }); |
224 | tempMap.put("AFT", new String[] { "Asia/Kabul" }); |
225 | tempMap.put("AHDT", new String[] { "America/Anchorage" }); |
226 | tempMap.put("AHST", new String[] { "America/Anchorage" }); |
227 | tempMap.put("AHWT", new String[] { "America/Anchorage" }); |
228 | tempMap.put("AKDT", new String[] { "America/Juneau", "America/Yakutat", |
229 | "America/Anchorage", "America/Nome" }); |
230 | tempMap.put("AKST", new String[] { "Asia/Aqtobe", "America/Juneau", |
231 | "America/Yakutat", "America/Anchorage", "America/Nome" }); |
232 | tempMap.put("AKT", new String[] { "Asia/Aqtobe" }); |
233 | tempMap.put("AKTST", new String[] { "Asia/Aqtobe" }); |
234 | tempMap.put("AKWT", new String[] { "America/Juneau", "America/Yakutat", |
235 | "America/Anchorage", "America/Nome" }); |
236 | tempMap.put("ALMST", new String[] { "Asia/Almaty" }); |
237 | tempMap.put("ALMT", new String[] { "Asia/Almaty" }); |
238 | tempMap.put("AMST", new String[] { "Asia/Yerevan", "America/Cuiaba", |
239 | "America/Porto_Velho", "America/Boa_Vista", "America/Manaus" }); |
240 | tempMap.put("AMT", new String[] { "Europe/Athens", "Europe/Amsterdam", |
241 | "Asia/Yerevan", "Africa/Asmera", "America/Cuiaba", |
242 | "America/Porto_Velho", "America/Boa_Vista", "America/Manaus", |
243 | "America/Asuncion" }); |
244 | tempMap.put("ANAMT", new String[] { "Asia/Anadyr" }); |
245 | tempMap.put("ANAST", new String[] { "Asia/Anadyr" }); |
246 | tempMap.put("ANAT", new String[] { "Asia/Anadyr" }); |
247 | tempMap.put("ANT", new String[] { "America/Aruba", "America/Curacao" }); |
248 | tempMap.put("AQTST", new String[] { "Asia/Aqtobe", "Asia/Aqtau" }); |
249 | tempMap.put("AQTT", new String[] { "Asia/Aqtobe", "Asia/Aqtau" }); |
250 | tempMap.put("ARST", new String[] { "Antarctica/Palmer", |
251 | "America/Buenos_Aires", "America/Rosario", "America/Cordoba", |
252 | "America/Jujuy", "America/Catamarca", "America/Mendoza" }); |
253 | tempMap.put("ART", new String[] { "Antarctica/Palmer", |
254 | "America/Buenos_Aires", "America/Rosario", "America/Cordoba", |
255 | "America/Jujuy", "America/Catamarca", "America/Mendoza" }); |
256 | tempMap.put("ASHST", new String[] { "Asia/Ashkhabad" }); |
257 | tempMap.put("ASHT", new String[] { "Asia/Ashkhabad" }); |
258 | tempMap.put("AST", new String[] { "Atlantic/Bermuda", "Asia/Bahrain", |
259 | "Asia/Baghdad", "Asia/Kuwait", "Asia/Qatar", "Asia/Riyadh", |
260 | "Asia/Aden", "America/Thule", "America/Goose_Bay", |
261 | "America/Halifax", "America/Glace_Bay", "America/Pangnirtung", |
262 | "America/Anguilla", "America/Antigua", "America/Barbados", |
263 | "America/Dominica", "America/Santo_Domingo", "America/Grenada", |
264 | "America/Guadeloupe", "America/Martinique", |
265 | "America/Montserrat", "America/Puerto_Rico", |
266 | "America/St_Kitts", "America/St_Lucia", "America/Miquelon", |
267 | "America/St_Vincent", "America/Tortola", "America/St_Thomas", |
268 | "America/Aruba", "America/Curacao", "America/Port_of_Spain" }); |
269 | tempMap.put("AWT", new String[] { "America/Puerto_Rico" }); |
270 | tempMap.put("AZOST", new String[] { "Atlantic/Azores" }); |
271 | tempMap.put("AZOT", new String[] { "Atlantic/Azores" }); |
272 | tempMap.put("AZST", new String[] { "Asia/Baku" }); |
273 | tempMap.put("AZT", new String[] { "Asia/Baku" }); |
274 | tempMap.put("BAKST", new String[] { "Asia/Baku" }); |
275 | tempMap.put("BAKT", new String[] { "Asia/Baku" }); |
276 | tempMap.put("BDT", new String[] { "Asia/Dacca", "America/Nome", |
277 | "America/Adak" }); |
278 | tempMap.put("BEAT", new String[] { "Africa/Nairobi", |
279 | "Africa/Mogadishu", "Africa/Kampala" }); |
280 | tempMap.put("BEAUT", new String[] { "Africa/Nairobi", |
281 | "Africa/Dar_es_Salaam", "Africa/Kampala" }); |
282 | tempMap.put("BMT", new String[] { "Europe/Brussels", "Europe/Chisinau", |
283 | "Europe/Tiraspol", "Europe/Bucharest", "Europe/Zurich", |
284 | "Asia/Baghdad", "Asia/Bangkok", "Africa/Banjul", |
285 | "America/Barbados", "America/Bogota" }); |
286 | tempMap.put("BNT", new String[] { "Asia/Brunei" }); |
287 | tempMap.put("BORT", |
288 | new String[] { "Asia/Ujung_Pandang", "Asia/Kuching" }); |
289 | tempMap.put("BOST", new String[] { "America/La_Paz" }); |
290 | tempMap.put("BOT", new String[] { "America/La_Paz" }); |
291 | tempMap.put("BRST", new String[] { "America/Belem", |
292 | "America/Fortaleza", "America/Araguaina", "America/Maceio", |
293 | "America/Sao_Paulo" }); |
294 | tempMap.put("BRT", new String[] { "America/Belem", "America/Fortaleza", |
295 | "America/Araguaina", "America/Maceio", "America/Sao_Paulo" }); |
296 | tempMap.put("BST", new String[] { "Europe/London", "Europe/Belfast", |
297 | "Europe/Dublin", "Europe/Gibraltar", "Pacific/Pago_Pago", |
298 | "Pacific/Midway", "America/Nome", "America/Adak" }); |
299 | tempMap.put("BTT", new String[] { "Asia/Thimbu" }); |
300 | tempMap.put("BURT", new String[] { "Asia/Dacca", "Asia/Rangoon", |
301 | "Asia/Calcutta" }); |
302 | tempMap.put("BWT", new String[] { "America/Nome", "America/Adak" }); |
303 | tempMap.put("CANT", new String[] { "Atlantic/Canary" }); |
304 | tempMap.put("CAST", |
305 | new String[] { "Africa/Gaborone", "Africa/Khartoum" }); |
306 | tempMap.put("CAT", new String[] { "Africa/Gaborone", |
307 | "Africa/Bujumbura", "Africa/Lubumbashi", "Africa/Blantyre", |
308 | "Africa/Maputo", "Africa/Windhoek", "Africa/Kigali", |
309 | "Africa/Khartoum", "Africa/Lusaka", "Africa/Harare", |
310 | "America/Anchorage" }); |
311 | tempMap.put("CCT", new String[] { "Indian/Cocos" }); |
312 | tempMap.put("CDDT", new String[] { "America/Rankin_Inlet" }); |
313 | tempMap.put("CDT", new String[] { "Asia/Harbin", "Asia/Shanghai", |
314 | "Asia/Chungking", "Asia/Urumqi", "Asia/Kashgar", "Asia/Taipei", |
315 | "Asia/Macao", "America/Chicago", "America/Indianapolis", |
316 | "America/Indiana/Marengo", "America/Indiana/Knox", |
317 | "America/Indiana/Vevay", "America/Louisville", |
318 | "America/Menominee", "America/Rainy_River", "America/Winnipeg", |
319 | "America/Pangnirtung", "America/Iqaluit", |
320 | "America/Rankin_Inlet", "America/Cambridge_Bay", |
321 | "America/Cancun", "America/Mexico_City", "America/Chihuahua", |
322 | "America/Belize", "America/Costa_Rica", "America/Havana", |
323 | "America/El_Salvador", "America/Guatemala", |
324 | "America/Tegucigalpa", "America/Managua" }); |
325 | tempMap.put("CEST", new String[] { "Europe/Tirane", "Europe/Andorra", |
326 | "Europe/Vienna", "Europe/Minsk", "Europe/Brussels", |
327 | "Europe/Sofia", "Europe/Prague", "Europe/Copenhagen", |
328 | "Europe/Tallinn", "Europe/Berlin", "Europe/Gibraltar", |
329 | "Europe/Athens", "Europe/Budapest", "Europe/Rome", |
330 | "Europe/Riga", "Europe/Vaduz", "Europe/Vilnius", |
331 | "Europe/Luxembourg", "Europe/Malta", "Europe/Chisinau", |
332 | "Europe/Tiraspol", "Europe/Monaco", "Europe/Amsterdam", |
333 | "Europe/Oslo", "Europe/Warsaw", "Europe/Lisbon", |
334 | "Europe/Kaliningrad", "Europe/Madrid", "Europe/Stockholm", |
335 | "Europe/Zurich", "Europe/Kiev", "Europe/Uzhgorod", |
336 | "Europe/Zaporozhye", "Europe/Simferopol", "Europe/Belgrade", |
337 | "Africa/Algiers", "Africa/Tripoli", "Africa/Tunis", |
338 | "Africa/Ceuta" }); |
339 | tempMap.put("CET", new String[] { "Europe/Tirane", "Europe/Andorra", |
340 | "Europe/Vienna", "Europe/Minsk", "Europe/Brussels", |
341 | "Europe/Sofia", "Europe/Prague", "Europe/Copenhagen", |
342 | "Europe/Tallinn", "Europe/Berlin", "Europe/Gibraltar", |
343 | "Europe/Athens", "Europe/Budapest", "Europe/Rome", |
344 | "Europe/Riga", "Europe/Vaduz", "Europe/Vilnius", |
345 | "Europe/Luxembourg", "Europe/Malta", "Europe/Chisinau", |
346 | "Europe/Tiraspol", "Europe/Monaco", "Europe/Amsterdam", |
347 | "Europe/Oslo", "Europe/Warsaw", "Europe/Lisbon", |
348 | "Europe/Kaliningrad", "Europe/Madrid", "Europe/Stockholm", |
349 | "Europe/Zurich", "Europe/Kiev", "Europe/Uzhgorod", |
350 | "Europe/Zaporozhye", "Europe/Simferopol", "Europe/Belgrade", |
351 | "Africa/Algiers", "Africa/Tripoli", "Africa/Casablanca", |
352 | "Africa/Tunis", "Africa/Ceuta" }); |
353 | tempMap.put("CGST", new String[] { "America/Scoresbysund" }); |
354 | tempMap.put("CGT", new String[] { "America/Scoresbysund" }); |
355 | tempMap.put("CHDT", new String[] { "America/Belize" }); |
356 | tempMap.put("CHUT", new String[] { "Asia/Chungking" }); |
357 | tempMap.put("CJT", new String[] { "Asia/Tokyo" }); |
358 | tempMap.put("CKHST", new String[] { "Pacific/Rarotonga" }); |
359 | tempMap.put("CKT", new String[] { "Pacific/Rarotonga" }); |
360 | tempMap.put("CLST", new String[] { "Antarctica/Palmer", |
361 | "America/Santiago" }); |
362 | tempMap.put("CLT", new String[] { "Antarctica/Palmer", |
363 | "America/Santiago" }); |
364 | tempMap.put("CMT", new String[] { "Europe/Copenhagen", |
365 | "Europe/Chisinau", "Europe/Tiraspol", "America/St_Lucia", |
366 | "America/Buenos_Aires", "America/Rosario", "America/Cordoba", |
367 | "America/Jujuy", "America/Catamarca", "America/Mendoza", |
368 | "America/Caracas" }); |
369 | tempMap.put("COST", new String[] { "America/Bogota" }); |
370 | tempMap.put("COT", new String[] { "America/Bogota" }); |
371 | tempMap |
372 | .put("CST", new String[] { "Asia/Harbin", "Asia/Shanghai", |
373 | "Asia/Chungking", "Asia/Urumqi", "Asia/Kashgar", |
374 | "Asia/Taipei", "Asia/Macao", "Asia/Jayapura", |
375 | "Australia/Darwin", "Australia/Adelaide", |
376 | "Australia/Broken_Hill", "America/Chicago", |
377 | "America/Indianapolis", "America/Indiana/Marengo", |
378 | "America/Indiana/Knox", "America/Indiana/Vevay", |
379 | "America/Louisville", "America/Detroit", |
380 | "America/Menominee", "America/Rainy_River", |
381 | "America/Winnipeg", "America/Regina", |
382 | "America/Swift_Current", "America/Pangnirtung", |
383 | "America/Iqaluit", "America/Rankin_Inlet", |
384 | "America/Cambridge_Bay", "America/Cancun", |
385 | "America/Mexico_City", "America/Chihuahua", |
386 | "America/Hermosillo", "America/Mazatlan", |
387 | "America/Belize", "America/Costa_Rica", |
388 | "America/Havana", "America/El_Salvador", |
389 | "America/Guatemala", "America/Tegucigalpa", |
390 | "America/Managua" }); |
391 | tempMap.put("CUT", new String[] { "Europe/Zaporozhye" }); |
392 | tempMap.put("CVST", new String[] { "Atlantic/Cape_Verde" }); |
393 | tempMap.put("CVT", new String[] { "Atlantic/Cape_Verde" }); |
394 | tempMap.put("CWT", new String[] { "America/Chicago", |
395 | "America/Indianapolis", "America/Indiana/Marengo", |
396 | "America/Indiana/Knox", "America/Indiana/Vevay", |
397 | "America/Louisville", "America/Menominee" }); |
398 | tempMap.put("CXT", new String[] { "Indian/Christmas" }); |
399 | tempMap.put("DACT", new String[] { "Asia/Dacca" }); |
400 | tempMap.put("DAVT", new String[] { "Antarctica/Davis" }); |
401 | tempMap.put("DDUT", new String[] { "Antarctica/DumontDUrville" }); |
402 | tempMap.put("DFT", new String[] { "Europe/Oslo", "Europe/Paris" }); |
403 | tempMap.put("DMT", new String[] { "Europe/Belfast", "Europe/Dublin" }); |
404 | tempMap.put("DUSST", new String[] { "Asia/Dushanbe" }); |
405 | tempMap.put("DUST", new String[] { "Asia/Dushanbe" }); |
406 | tempMap.put("EASST", new String[] { "Pacific/Easter" }); |
407 | tempMap.put("EAST", new String[] { "Indian/Antananarivo", |
408 | "Pacific/Easter" }); |
409 | tempMap.put("EAT", new String[] { "Indian/Comoro", |
410 | "Indian/Antananarivo", "Indian/Mayotte", "Africa/Djibouti", |
411 | "Africa/Asmera", "Africa/Addis_Ababa", "Africa/Nairobi", |
412 | "Africa/Mogadishu", "Africa/Khartoum", "Africa/Dar_es_Salaam", |
413 | "Africa/Kampala" }); |
414 | tempMap.put("ECT", new String[] { "Pacific/Galapagos", |
415 | "America/Guayaquil" }); |
416 | tempMap.put("EDDT", new String[] { "America/Iqaluit" }); |
417 | tempMap.put("EDT", new String[] { "America/New_York", |
418 | "America/Indianapolis", "America/Indiana/Marengo", |
419 | "America/Indiana/Vevay", "America/Louisville", |
420 | "America/Detroit", "America/Montreal", "America/Thunder_Bay", |
421 | "America/Nipigon", "America/Pangnirtung", "America/Iqaluit", |
422 | "America/Cancun", "America/Nassau", "America/Santo_Domingo", |
423 | "America/Port-au-Prince", "America/Jamaica", |
424 | "America/Grand_Turk" }); |
425 | tempMap.put("EEMT", new String[] { "Europe/Minsk", "Europe/Chisinau", |
426 | "Europe/Tiraspol", "Europe/Kaliningrad", "Europe/Moscow" }); |
427 | tempMap.put("EEST", new String[] { "Europe/Minsk", "Europe/Sofia", |
428 | "Europe/Tallinn", "Europe/Helsinki", "Europe/Athens", |
429 | "Europe/Riga", "Europe/Vilnius", "Europe/Chisinau", |
430 | "Europe/Tiraspol", "Europe/Warsaw", "Europe/Bucharest", |
431 | "Europe/Kaliningrad", "Europe/Moscow", "Europe/Istanbul", |
432 | "Europe/Kiev", "Europe/Uzhgorod", "Europe/Zaporozhye", |
433 | "Asia/Nicosia", "Asia/Amman", "Asia/Beirut", "Asia/Gaza", |
434 | "Asia/Damascus", "Africa/Cairo" }); |
435 | tempMap.put("EET", new String[] { "Europe/Minsk", "Europe/Sofia", |
436 | "Europe/Tallinn", "Europe/Helsinki", "Europe/Athens", |
437 | "Europe/Riga", "Europe/Vilnius", "Europe/Chisinau", |
438 | "Europe/Tiraspol", "Europe/Warsaw", "Europe/Bucharest", |
439 | "Europe/Kaliningrad", "Europe/Moscow", "Europe/Istanbul", |
440 | "Europe/Kiev", "Europe/Uzhgorod", "Europe/Zaporozhye", |
441 | "Europe/Simferopol", "Asia/Nicosia", "Asia/Amman", |
442 | "Asia/Beirut", "Asia/Gaza", "Asia/Damascus", "Africa/Cairo", |
443 | "Africa/Tripoli" }); |
444 | tempMap.put("EGST", new String[] { "America/Scoresbysund" }); |
445 | tempMap.put("EGT", new String[] { "Atlantic/Jan_Mayen", |
446 | "America/Scoresbysund" }); |
447 | tempMap.put("EHDT", new String[] { "America/Santo_Domingo" }); |
448 | tempMap.put("EST", new String[] { "Australia/Brisbane", |
449 | "Australia/Lindeman", "Australia/Hobart", |
450 | "Australia/Melbourne", "Australia/Sydney", |
451 | "Australia/Broken_Hill", "Australia/Lord_Howe", |
452 | "America/New_York", "America/Chicago", "America/Indianapolis", |
453 | "America/Indiana/Marengo", "America/Indiana/Knox", |
454 | "America/Indiana/Vevay", "America/Louisville", |
455 | "America/Detroit", "America/Menominee", "America/Montreal", |
456 | "America/Thunder_Bay", "America/Nipigon", |
457 | "America/Pangnirtung", "America/Iqaluit", "America/Cancun", |
458 | "America/Antigua", "America/Nassau", "America/Cayman", |
459 | "America/Santo_Domingo", "America/Port-au-Prince", |
460 | "America/Jamaica", "America/Managua", "America/Panama", |
461 | "America/Grand_Turk" }); |
462 | tempMap.put("EWT", new String[] { "America/New_York", |
463 | "America/Indianapolis", "America/Indiana/Marengo", |
464 | "America/Indiana/Vevay", "America/Louisville", |
465 | "America/Detroit", "America/Jamaica" }); |
466 | tempMap.put("FFMT", new String[] { "America/Martinique" }); |
467 | tempMap.put("FJST", new String[] { "Pacific/Fiji" }); |
468 | tempMap.put("FJT", new String[] { "Pacific/Fiji" }); |
469 | tempMap.put("FKST", new String[] { "Atlantic/Stanley" }); |
470 | tempMap.put("FKT", new String[] { "Atlantic/Stanley" }); |
471 | tempMap.put("FMT", |
472 | new String[] { "Atlantic/Madeira", "Africa/Freetown" }); |
473 | tempMap.put("FNST", new String[] { "America/Noronha" }); |
474 | tempMap.put("FNT", new String[] { "America/Noronha" }); |
475 | tempMap.put("FRUST", new String[] { "Asia/Bishkek" }); |
476 | tempMap.put("FRUT", new String[] { "Asia/Bishkek" }); |
477 | tempMap.put("GALT", new String[] { "Pacific/Galapagos" }); |
478 | tempMap.put("GAMT", new String[] { "Pacific/Gambier" }); |
479 | tempMap.put("GBGT", new String[] { "America/Guyana" }); |
480 | tempMap.put("GEST", new String[] { "Asia/Tbilisi" }); |
481 | tempMap.put("GET", new String[] { "Asia/Tbilisi" }); |
482 | tempMap.put("GFT", new String[] { "America/Cayenne" }); |
483 | tempMap.put("GHST", new String[] { "Africa/Accra" }); |
484 | tempMap.put("GILT", new String[] { "Pacific/Tarawa" }); |
485 | tempMap.put("GMT", new String[] { "Atlantic/St_Helena", |
486 | "Atlantic/Reykjavik", "Europe/London", "Europe/Belfast", |
487 | "Europe/Dublin", "Europe/Gibraltar", "Africa/Porto-Novo", |
488 | "Africa/Ouagadougou", "Africa/Abidjan", "Africa/Malabo", |
489 | "Africa/Banjul", "Africa/Accra", "Africa/Conakry", |
490 | "Africa/Bissau", "Africa/Monrovia", "Africa/Bamako", |
491 | "Africa/Timbuktu", "Africa/Nouakchott", "Africa/Niamey", |
492 | "Africa/Sao_Tome", "Africa/Dakar", "Africa/Freetown", |
493 | "Africa/Lome" }); |
494 | tempMap.put("GST", new String[] { "Atlantic/South_Georgia", |
495 | "Asia/Bahrain", "Asia/Muscat", "Asia/Qatar", "Asia/Dubai", |
496 | "Pacific/Guam" }); |
497 | tempMap.put("GYT", new String[] { "America/Guyana" }); |
498 | tempMap.put("HADT", new String[] { "America/Adak" }); |
499 | tempMap.put("HART", new String[] { "Asia/Harbin" }); |
500 | tempMap.put("HAST", new String[] { "America/Adak" }); |
501 | tempMap.put("HAWT", new String[] { "America/Adak" }); |
502 | tempMap.put("HDT", new String[] { "Pacific/Honolulu" }); |
503 | tempMap.put("HKST", new String[] { "Asia/Hong_Kong" }); |
504 | tempMap.put("HKT", new String[] { "Asia/Hong_Kong" }); |
505 | tempMap.put("HMT", new String[] { "Atlantic/Azores", "Europe/Helsinki", |
506 | "Asia/Dacca", "Asia/Calcutta", "America/Havana" }); |
507 | tempMap.put("HOVST", new String[] { "Asia/Hovd" }); |
508 | tempMap.put("HOVT", new String[] { "Asia/Hovd" }); |
509 | tempMap.put("HST", new String[] { "Pacific/Johnston", |
510 | "Pacific/Honolulu" }); |
511 | tempMap.put("HWT", new String[] { "Pacific/Honolulu" }); |
512 | tempMap.put("ICT", new String[] { "Asia/Phnom_Penh", "Asia/Vientiane", |
513 | "Asia/Bangkok", "Asia/Saigon" }); |
514 | tempMap.put("IDDT", new String[] { "Asia/Jerusalem", "Asia/Gaza" }); |
515 | tempMap.put("IDT", new String[] { "Asia/Jerusalem", "Asia/Gaza" }); |
516 | tempMap.put("IHST", new String[] { "Asia/Colombo" }); |
517 | tempMap.put("IMT", new String[] { "Europe/Sofia", "Europe/Istanbul", |
518 | "Asia/Irkutsk" }); |
519 | tempMap.put("IOT", new String[] { "Indian/Chagos" }); |
520 | tempMap.put("IRKMT", new String[] { "Asia/Irkutsk" }); |
521 | tempMap.put("IRKST", new String[] { "Asia/Irkutsk" }); |
522 | tempMap.put("IRKT", new String[] { "Asia/Irkutsk" }); |
523 | tempMap.put("IRST", new String[] { "Asia/Tehran" }); |
524 | tempMap.put("IRT", new String[] { "Asia/Tehran" }); |
525 | tempMap.put("ISST", new String[] { "Atlantic/Reykjavik" }); |
526 | tempMap.put("IST", new String[] { "Atlantic/Reykjavik", |
527 | "Europe/Belfast", "Europe/Dublin", "Asia/Dacca", "Asia/Thimbu", |
528 | "Asia/Calcutta", "Asia/Jerusalem", "Asia/Katmandu", |
529 | "Asia/Karachi", "Asia/Gaza", "Asia/Colombo" }); |
530 | tempMap.put("JAYT", new String[] { "Asia/Jayapura" }); |
531 | tempMap.put("JMT", new String[] { "Atlantic/St_Helena", |
532 | "Asia/Jerusalem" }); |
533 | tempMap.put("JST", new String[] { "Asia/Rangoon", "Asia/Dili", |
534 | "Asia/Ujung_Pandang", "Asia/Tokyo", "Asia/Kuala_Lumpur", |
535 | "Asia/Kuching", "Asia/Manila", "Asia/Singapore", |
536 | "Pacific/Nauru" }); |
537 | tempMap.put("KART", new String[] { "Asia/Karachi" }); |
538 | tempMap.put("KAST", new String[] { "Asia/Kashgar" }); |
539 | tempMap.put("KDT", new String[] { "Asia/Seoul" }); |
540 | tempMap.put("KGST", new String[] { "Asia/Bishkek" }); |
541 | tempMap.put("KGT", new String[] { "Asia/Bishkek" }); |
542 | tempMap.put("KMT", new String[] { "Europe/Vilnius", "Europe/Kiev", |
543 | "America/Cayman", "America/Jamaica", "America/St_Vincent", |
544 | "America/Grand_Turk" }); |
545 | tempMap.put("KOST", new String[] { "Pacific/Kosrae" }); |
546 | tempMap.put("KRAMT", new String[] { "Asia/Krasnoyarsk" }); |
547 | tempMap.put("KRAST", new String[] { "Asia/Krasnoyarsk" }); |
548 | tempMap.put("KRAT", new String[] { "Asia/Krasnoyarsk" }); |
549 | tempMap.put("KST", new String[] { "Asia/Seoul", "Asia/Pyongyang" }); |
550 | tempMap.put("KUYMT", new String[] { "Europe/Samara" }); |
551 | tempMap.put("KUYST", new String[] { "Europe/Samara" }); |
552 | tempMap.put("KUYT", new String[] { "Europe/Samara" }); |
553 | tempMap.put("KWAT", new String[] { "Pacific/Kwajalein" }); |
554 | tempMap.put("LHST", new String[] { "Australia/Lord_Howe" }); |
555 | tempMap.put("LINT", new String[] { "Pacific/Kiritimati" }); |
556 | tempMap.put("LKT", new String[] { "Asia/Colombo" }); |
557 | tempMap.put("LPMT", new String[] { "America/La_Paz" }); |
558 | tempMap.put("LRT", new String[] { "Africa/Monrovia" }); |
559 | tempMap.put("LST", new String[] { "Europe/Riga" }); |
560 | tempMap.put("M", new String[] { "Europe/Moscow" }); |
561 | tempMap.put("MADST", new String[] { "Atlantic/Madeira" }); |
562 | tempMap.put("MAGMT", new String[] { "Asia/Magadan" }); |
563 | tempMap.put("MAGST", new String[] { "Asia/Magadan" }); |
564 | tempMap.put("MAGT", new String[] { "Asia/Magadan" }); |
565 | tempMap.put("MALT", new String[] { "Asia/Kuala_Lumpur", |
566 | "Asia/Singapore" }); |
567 | tempMap.put("MART", new String[] { "Pacific/Marquesas" }); |
568 | tempMap.put("MAWT", new String[] { "Antarctica/Mawson" }); |
569 | tempMap.put("MDDT", new String[] { "America/Cambridge_Bay", |
570 | "America/Yellowknife", "America/Inuvik" }); |
571 | tempMap.put("MDST", new String[] { "Europe/Moscow" }); |
572 | tempMap.put("MDT", new String[] { "America/Denver", "America/Phoenix", |
573 | "America/Boise", "America/Regina", "America/Swift_Current", |
574 | "America/Edmonton", "America/Cambridge_Bay", |
575 | "America/Yellowknife", "America/Inuvik", "America/Chihuahua", |
576 | "America/Hermosillo", "America/Mazatlan" }); |
577 | tempMap.put("MET", new String[] { "Europe/Tirane", "Europe/Andorra", |
578 | "Europe/Vienna", "Europe/Minsk", "Europe/Brussels", |
579 | "Europe/Sofia", "Europe/Prague", "Europe/Copenhagen", |
580 | "Europe/Tallinn", "Europe/Berlin", "Europe/Gibraltar", |
581 | "Europe/Athens", "Europe/Budapest", "Europe/Rome", |
582 | "Europe/Riga", "Europe/Vaduz", "Europe/Vilnius", |
583 | "Europe/Luxembourg", "Europe/Malta", "Europe/Chisinau", |
584 | "Europe/Tiraspol", "Europe/Monaco", "Europe/Amsterdam", |
585 | "Europe/Oslo", "Europe/Warsaw", "Europe/Lisbon", |
586 | "Europe/Kaliningrad", "Europe/Madrid", "Europe/Stockholm", |
587 | "Europe/Zurich", "Europe/Kiev", "Europe/Uzhgorod", |
588 | "Europe/Zaporozhye", "Europe/Simferopol", "Europe/Belgrade", |
589 | "Africa/Algiers", "Africa/Tripoli", "Africa/Casablanca", |
590 | "Africa/Tunis", "Africa/Ceuta" }); |
591 | tempMap.put("MHT", |
592 | new String[] { "Pacific/Majuro", "Pacific/Kwajalein" }); |
593 | tempMap.put("MMT", new String[] { "Indian/Maldives", "Europe/Minsk", |
594 | "Europe/Moscow", "Asia/Rangoon", "Asia/Ujung_Pandang", |
595 | "Asia/Colombo", "Pacific/Easter", "Africa/Monrovia", |
596 | "America/Managua", "America/Montevideo" }); |
597 | tempMap.put("MOST", new String[] { "Asia/Macao" }); |
598 | tempMap.put("MOT", new String[] { "Asia/Macao" }); |
599 | tempMap.put("MPT", new String[] { "Pacific/Saipan" }); |
600 | tempMap.put("MSK", new String[] { "Europe/Minsk", "Europe/Tallinn", |
601 | "Europe/Riga", "Europe/Vilnius", "Europe/Chisinau", |
602 | "Europe/Kiev", "Europe/Uzhgorod", "Europe/Zaporozhye", |
603 | "Europe/Simferopol" }); |
604 | tempMap.put("MST", new String[] { "Europe/Moscow", "America/Denver", |
605 | "America/Phoenix", "America/Boise", "America/Regina", |
606 | "America/Swift_Current", "America/Edmonton", |
607 | "America/Dawson_Creek", "America/Cambridge_Bay", |
608 | "America/Yellowknife", "America/Inuvik", "America/Mexico_City", |
609 | "America/Chihuahua", "America/Hermosillo", "America/Mazatlan", |
610 | "America/Tijuana" }); |
611 | tempMap.put("MUT", new String[] { "Indian/Mauritius" }); |
612 | tempMap.put("MVT", new String[] { "Indian/Maldives" }); |
613 | tempMap.put("MWT", new String[] { "America/Denver", "America/Phoenix", |
614 | "America/Boise" }); |
615 | tempMap |
616 | .put("MYT", |
617 | new String[] { "Asia/Kuala_Lumpur", "Asia/Kuching" }); |
618 | tempMap.put("NCST", new String[] { "Pacific/Noumea" }); |
619 | tempMap.put("NCT", new String[] { "Pacific/Noumea" }); |
620 | tempMap.put("NDT", new String[] { "America/Nome", "America/Adak", |
621 | "America/St_Johns", "America/Goose_Bay" }); |
622 | tempMap.put("NEGT", new String[] { "America/Paramaribo" }); |
623 | tempMap.put("NFT", new String[] { "Europe/Paris", "Europe/Oslo", |
624 | "Pacific/Norfolk" }); |
625 | tempMap.put("NMT", new String[] { "Pacific/Norfolk" }); |
626 | tempMap.put("NOVMT", new String[] { "Asia/Novosibirsk" }); |
627 | tempMap.put("NOVST", new String[] { "Asia/Novosibirsk" }); |
628 | tempMap.put("NOVT", new String[] { "Asia/Novosibirsk" }); |
629 | tempMap.put("NPT", new String[] { "Asia/Katmandu" }); |
630 | tempMap.put("NRT", new String[] { "Pacific/Nauru" }); |
631 | tempMap.put("NST", new String[] { "Europe/Amsterdam", |
632 | "Pacific/Pago_Pago", "Pacific/Midway", "America/Nome", |
633 | "America/Adak", "America/St_Johns", "America/Goose_Bay" }); |
634 | tempMap.put("NUT", new String[] { "Pacific/Niue" }); |
635 | tempMap.put("NWT", new String[] { "America/Nome", "America/Adak" }); |
636 | tempMap.put("NZDT", new String[] { "Antarctica/McMurdo" }); |
637 | tempMap.put("NZHDT", new String[] { "Pacific/Auckland" }); |
638 | tempMap.put("NZST", new String[] { "Antarctica/McMurdo", |
639 | "Pacific/Auckland" }); |
640 | tempMap.put("OMSMT", new String[] { "Asia/Omsk" }); |
641 | tempMap.put("OMSST", new String[] { "Asia/Omsk" }); |
642 | tempMap.put("OMST", new String[] { "Asia/Omsk" }); |
643 | tempMap.put("PDDT", new String[] { "America/Inuvik", |
644 | "America/Whitehorse", "America/Dawson" }); |
645 | tempMap.put("PDT", new String[] { "America/Los_Angeles", |
646 | "America/Juneau", "America/Boise", "America/Vancouver", |
647 | "America/Dawson_Creek", "America/Inuvik", "America/Whitehorse", |
648 | "America/Dawson", "America/Tijuana" }); |
649 | tempMap.put("PEST", new String[] { "America/Lima" }); |
650 | tempMap.put("PET", new String[] { "America/Lima" }); |
651 | tempMap.put("PETMT", new String[] { "Asia/Kamchatka" }); |
652 | tempMap.put("PETST", new String[] { "Asia/Kamchatka" }); |
653 | tempMap.put("PETT", new String[] { "Asia/Kamchatka" }); |
654 | tempMap.put("PGT", new String[] { "Pacific/Port_Moresby" }); |
655 | tempMap.put("PHOT", new String[] { "Pacific/Enderbury" }); |
656 | tempMap.put("PHST", new String[] { "Asia/Manila" }); |
657 | tempMap.put("PHT", new String[] { "Asia/Manila" }); |
658 | tempMap.put("PKT", new String[] { "Asia/Karachi" }); |
659 | tempMap.put("PMDT", new String[] { "America/Miquelon" }); |
660 | tempMap.put("PMMT", new String[] { "Pacific/Port_Moresby" }); |
661 | tempMap.put("PMST", new String[] { "America/Miquelon" }); |
662 | tempMap.put("PMT", new String[] { "Antarctica/DumontDUrville", |
663 | "Europe/Prague", "Europe/Paris", "Europe/Monaco", |
664 | "Africa/Algiers", "Africa/Tunis", "America/Panama", |
665 | "America/Paramaribo" }); |
666 | tempMap.put("PNT", new String[] { "Pacific/Pitcairn" }); |
667 | tempMap.put("PONT", new String[] { "Pacific/Ponape" }); |
668 | tempMap.put("PPMT", new String[] { "America/Port-au-Prince" }); |
669 | tempMap.put("PST", new String[] { "Pacific/Pitcairn", |
670 | "America/Los_Angeles", "America/Juneau", "America/Boise", |
671 | "America/Vancouver", "America/Dawson_Creek", "America/Inuvik", |
672 | "America/Whitehorse", "America/Dawson", "America/Hermosillo", |
673 | "America/Mazatlan", "America/Tijuana" }); |
674 | tempMap.put("PWT", new String[] { "Pacific/Palau", |
675 | "America/Los_Angeles", "America/Juneau", "America/Boise", |
676 | "America/Tijuana" }); |
677 | tempMap.put("PYST", new String[] { "America/Asuncion" }); |
678 | tempMap.put("PYT", new String[] { "America/Asuncion" }); |
679 | tempMap.put("QMT", new String[] { "America/Guayaquil" }); |
680 | tempMap.put("RET", new String[] { "Indian/Reunion" }); |
681 | tempMap.put("RMT", new String[] { "Atlantic/Reykjavik", "Europe/Rome", |
682 | "Europe/Riga", "Asia/Rangoon" }); |
683 | tempMap.put("S", new String[] { "Europe/Moscow" }); |
684 | tempMap.put("SAMMT", new String[] { "Europe/Samara" }); |
685 | tempMap |
686 | .put("SAMST", |
687 | new String[] { "Europe/Samara", "Asia/Samarkand" }); |
688 | tempMap.put("SAMT", new String[] { "Europe/Samara", "Asia/Samarkand", |
689 | "Pacific/Pago_Pago", "Pacific/Apia" }); |
690 | tempMap.put("SAST", new String[] { "Africa/Maseru", "Africa/Windhoek", |
691 | "Africa/Johannesburg", "Africa/Mbabane" }); |
692 | tempMap.put("SBT", new String[] { "Pacific/Guadalcanal" }); |
693 | tempMap.put("SCT", new String[] { "Indian/Mahe" }); |
694 | tempMap.put("SDMT", new String[] { "America/Santo_Domingo" }); |
695 | tempMap.put("SGT", new String[] { "Asia/Singapore" }); |
696 | tempMap.put("SHEST", new String[] { "Asia/Aqtau" }); |
697 | tempMap.put("SHET", new String[] { "Asia/Aqtau" }); |
698 | tempMap.put("SJMT", new String[] { "America/Costa_Rica" }); |
699 | tempMap.put("SLST", new String[] { "Africa/Freetown" }); |
700 | tempMap.put("SMT", new String[] { "Atlantic/Stanley", |
701 | "Europe/Stockholm", "Europe/Simferopol", "Asia/Phnom_Penh", |
702 | "Asia/Vientiane", "Asia/Kuala_Lumpur", "Asia/Singapore", |
703 | "Asia/Saigon", "America/Santiago" }); |
704 | tempMap.put("SRT", new String[] { "America/Paramaribo" }); |
705 | tempMap.put("SST", |
706 | new String[] { "Pacific/Pago_Pago", "Pacific/Midway" }); |
707 | tempMap.put("SVEMT", new String[] { "Asia/Yekaterinburg" }); |
708 | tempMap.put("SVEST", new String[] { "Asia/Yekaterinburg" }); |
709 | tempMap.put("SVET", new String[] { "Asia/Yekaterinburg" }); |
710 | tempMap.put("SWAT", new String[] { "Africa/Windhoek" }); |
711 | tempMap.put("SYOT", new String[] { "Antarctica/Syowa" }); |
712 | tempMap.put("TAHT", new String[] { "Pacific/Tahiti" }); |
713 | tempMap |
714 | .put("TASST", |
715 | new String[] { "Asia/Samarkand", "Asia/Tashkent" }); |
716 | tempMap.put("TAST", new String[] { "Asia/Samarkand", "Asia/Tashkent" }); |
717 | tempMap.put("TBIST", new String[] { "Asia/Tbilisi" }); |
718 | tempMap.put("TBIT", new String[] { "Asia/Tbilisi" }); |
719 | tempMap.put("TBMT", new String[] { "Asia/Tbilisi" }); |
720 | tempMap.put("TFT", new String[] { "Indian/Kerguelen" }); |
721 | tempMap.put("TJT", new String[] { "Asia/Dushanbe" }); |
722 | tempMap.put("TKT", new String[] { "Pacific/Fakaofo" }); |
723 | tempMap.put("TMST", new String[] { "Asia/Ashkhabad" }); |
724 | tempMap.put("TMT", new String[] { "Europe/Tallinn", "Asia/Tehran", |
725 | "Asia/Ashkhabad" }); |
726 | tempMap.put("TOST", new String[] { "Pacific/Tongatapu" }); |
727 | tempMap.put("TOT", new String[] { "Pacific/Tongatapu" }); |
728 | tempMap.put("TPT", new String[] { "Asia/Dili" }); |
729 | tempMap.put("TRST", new String[] { "Europe/Istanbul" }); |
730 | tempMap.put("TRT", new String[] { "Europe/Istanbul" }); |
731 | tempMap.put("TRUT", new String[] { "Pacific/Truk" }); |
732 | tempMap.put("TVT", new String[] { "Pacific/Funafuti" }); |
733 | tempMap.put("ULAST", new String[] { "Asia/Ulaanbaatar" }); |
734 | tempMap.put("ULAT", new String[] { "Asia/Ulaanbaatar" }); |
735 | tempMap.put("URUT", new String[] { "Asia/Urumqi" }); |
736 | tempMap.put("UYHST", new String[] { "America/Montevideo" }); |
737 | tempMap.put("UYT", new String[] { "America/Montevideo" }); |
738 | tempMap.put("UZST", new String[] { "Asia/Samarkand", "Asia/Tashkent" }); |
739 | tempMap.put("UZT", new String[] { "Asia/Samarkand", "Asia/Tashkent" }); |
740 | tempMap.put("VET", new String[] { "America/Caracas" }); |
741 | tempMap.put("VLAMT", new String[] { "Asia/Vladivostok" }); |
742 | tempMap.put("VLAST", new String[] { "Asia/Vladivostok" }); |
743 | tempMap.put("VLAT", new String[] { "Asia/Vladivostok" }); |
744 | tempMap.put("VUST", new String[] { "Pacific/Efate" }); |
745 | tempMap.put("VUT", new String[] { "Pacific/Efate" }); |
746 | tempMap.put("WAKT", new String[] { "Pacific/Wake" }); |
747 | tempMap.put("WARST", |
748 | new String[] { "America/Jujuy", "America/Mendoza" }); |
749 | tempMap |
750 | .put("WART", |
751 | new String[] { "America/Jujuy", "America/Mendoza" }); |
752 | tempMap.put("WAST", |
753 | new String[] { "Africa/Ndjamena", "Africa/Windhoek" }); |
754 | tempMap.put("WAT", new String[] { "Africa/Luanda", "Africa/Porto-Novo", |
755 | "Africa/Douala", "Africa/Bangui", "Africa/Ndjamena", |
756 | "Africa/Kinshasa", "Africa/Brazzaville", "Africa/Malabo", |
757 | "Africa/Libreville", "Africa/Banjul", "Africa/Conakry", |
758 | "Africa/Bissau", "Africa/Bamako", "Africa/Nouakchott", |
759 | "Africa/El_Aaiun", "Africa/Windhoek", "Africa/Niamey", |
760 | "Africa/Lagos", "Africa/Dakar", "Africa/Freetown" }); |
761 | tempMap.put("WEST", new String[] { "Atlantic/Faeroe", |
762 | "Atlantic/Azores", "Atlantic/Madeira", "Atlantic/Canary", |
763 | "Europe/Brussels", "Europe/Luxembourg", "Europe/Monaco", |
764 | "Europe/Lisbon", "Europe/Madrid", "Africa/Algiers", |
765 | "Africa/Casablanca", "Africa/Ceuta" }); |
766 | tempMap.put("WET", new String[] { "Atlantic/Faeroe", "Atlantic/Azores", |
767 | "Atlantic/Madeira", "Atlantic/Canary", "Europe/Andorra", |
768 | "Europe/Brussels", "Europe/Luxembourg", "Europe/Monaco", |
769 | "Europe/Lisbon", "Europe/Madrid", "Africa/Algiers", |
770 | "Africa/Casablanca", "Africa/El_Aaiun", "Africa/Ceuta" }); |
771 | tempMap.put("WFT", new String[] { "Pacific/Wallis" }); |
772 | tempMap.put("WGST", new String[] { "America/Godthab" }); |
773 | tempMap.put("WGT", new String[] { "America/Godthab" }); |
774 | tempMap.put("WMT", new String[] { "Europe/Vilnius", "Europe/Warsaw" }); |
775 | tempMap.put("WST", new String[] { "Antarctica/Casey", "Pacific/Apia", |
776 | "Australia/Perth" }); |
777 | tempMap.put("YAKMT", new String[] { "Asia/Yakutsk" }); |
778 | tempMap.put("YAKST", new String[] { "Asia/Yakutsk" }); |
779 | tempMap.put("YAKT", new String[] { "Asia/Yakutsk" }); |
780 | tempMap.put("YAPT", new String[] { "Pacific/Yap" }); |
781 | tempMap.put("YDDT", new String[] { "America/Whitehorse", |
782 | "America/Dawson" }); |
783 | tempMap.put("YDT", new String[] { "America/Yakutat", |
784 | "America/Whitehorse", "America/Dawson" }); |
785 | tempMap.put("YEKMT", new String[] { "Asia/Yekaterinburg" }); |
786 | tempMap.put("YEKST", new String[] { "Asia/Yekaterinburg" }); |
787 | tempMap.put("YEKT", new String[] { "Asia/Yekaterinburg" }); |
788 | tempMap.put("YERST", new String[] { "Asia/Yerevan" }); |
789 | tempMap.put("YERT", new String[] { "Asia/Yerevan" }); |
790 | tempMap.put("YST", new String[] { "America/Yakutat", |
791 | "America/Whitehorse", "America/Dawson" }); |
792 | tempMap.put("YWT", new String[] { "America/Yakutat" }); |
793 | |
794 | ABBREVIATED_TIMEZONES = Collections.unmodifiableMap(tempMap); |
795 | } |
796 | |
797 | /** |
798 | * Change the given times from one timezone to another |
799 | * |
800 | * @param conn |
801 | * the current connection to the MySQL server |
802 | * @param t |
803 | * the times to change |
804 | * @param fromTz |
805 | * the timezone to change from |
806 | * @param toTz |
807 | * the timezone to change to |
808 | * |
809 | * @return the times changed to the timezone 'toTz' |
810 | */ |
811 | public static Time changeTimezone(Connection conn, |
812 | Calendar sessionCalendar, |
813 | Calendar targetCalendar, |
814 | Time t, |
815 | TimeZone fromTz, |
816 | TimeZone toTz, |
817 | boolean rollForward) { |
818 | if ((conn != null)) { |
819 | if (conn.getUseTimezone() && |
820 | !conn.getNoTimezoneConversionForTimeType()) { |
821 | // Convert the timestamp from GMT to the server's timezone |
822 | Calendar fromCal = Calendar.getInstance(fromTz); |
823 | fromCal.setTime(t); |
824 | |
825 | int fromOffset = fromCal.get(Calendar.ZONE_OFFSET) |
826 | + fromCal.get(Calendar.DST_OFFSET); |
827 | Calendar toCal = Calendar.getInstance(toTz); |
828 | toCal.setTime(t); |
829 | |
830 | int toOffset = toCal.get(Calendar.ZONE_OFFSET) |
831 | + toCal.get(Calendar.DST_OFFSET); |
832 | int offsetDiff = fromOffset - toOffset; |
833 | long toTime = toCal.getTime().getTime(); |
834 | |
835 | if (rollForward || (conn.isServerTzUTC() && !conn.isClientTzUTC())) { |
836 | toTime += offsetDiff; |
837 | } else { |
838 | toTime -= offsetDiff; |
839 | } |
840 | |
841 | Time changedTime = new Time(toTime); |
842 | |
843 | return changedTime; |
844 | } else if (conn.getUseJDBCCompliantTimezoneShift()) { |
845 | if (targetCalendar != null) { |
846 | |
847 | Time adjustedTime = new Time( |
848 | jdbcCompliantZoneShift(sessionCalendar, |
849 | targetCalendar, t)); |
850 | |
851 | return adjustedTime; |
852 | } |
853 | } |
854 | } |
855 | |
856 | return t; |
857 | } |
858 | |
859 | /** |
860 | * Change the given timestamp from one timezone to another |
861 | * |
862 | * @param conn |
863 | * the current connection to the MySQL server |
864 | * @param tstamp |
865 | * the timestamp to change |
866 | * @param fromTz |
867 | * the timezone to change from |
868 | * @param toTz |
869 | * the timezone to change to |
870 | * |
871 | * @return the timestamp changed to the timezone 'toTz' |
872 | */ |
873 | public static Timestamp changeTimezone(Connection conn, |
874 | Calendar sessionCalendar, |
875 | Calendar targetCalendar, |
876 | Timestamp tstamp, |
877 | TimeZone fromTz, |
878 | TimeZone toTz, |
879 | boolean rollForward) { |
880 | if ((conn != null)) { |
881 | if (conn.getUseTimezone()) { |
882 | // Convert the timestamp from GMT to the server's timezone |
883 | Calendar fromCal = Calendar.getInstance(fromTz); |
884 | fromCal.setTime(tstamp); |
885 | |
886 | int fromOffset = fromCal.get(Calendar.ZONE_OFFSET) |
887 | + fromCal.get(Calendar.DST_OFFSET); |
888 | Calendar toCal = Calendar.getInstance(toTz); |
889 | toCal.setTime(tstamp); |
890 | |
891 | int toOffset = toCal.get(Calendar.ZONE_OFFSET) |
892 | + toCal.get(Calendar.DST_OFFSET); |
893 | int offsetDiff = fromOffset - toOffset; |
894 | long toTime = toCal.getTime().getTime(); |
895 | |
896 | if (rollForward || (conn.isServerTzUTC() && !conn.isClientTzUTC())) { |
897 | toTime += offsetDiff; |
898 | } else { |
899 | toTime -= offsetDiff; |
900 | } |
901 | |
902 | Timestamp changedTimestamp = new Timestamp(toTime); |
903 | |
904 | return changedTimestamp; |
905 | } else if (conn.getUseJDBCCompliantTimezoneShift()) { |
906 | if (targetCalendar != null) { |
907 | |
908 | Timestamp adjustedTimestamp = new Timestamp( |
909 | jdbcCompliantZoneShift(sessionCalendar, |
910 | targetCalendar, tstamp)); |
911 | |
912 | adjustedTimestamp.setNanos(tstamp.getNanos()); |
913 | |
914 | return adjustedTimestamp; |
915 | } |
916 | } |
917 | } |
918 | |
919 | return tstamp; |
920 | } |
921 | |
922 | private static long jdbcCompliantZoneShift(Calendar sessionCalendar, |
923 | Calendar targetCalendar, |
924 | java.util.Date dt) { |
925 | if (sessionCalendar == null) { |
926 | sessionCalendar = new GregorianCalendar(); |
927 | } |
928 | |
929 | // JDBC spec is not clear whether or not this |
930 | // calendar should be immutable, so let's treat |
931 | // it like it is, for safety |
932 | |
933 | java.util.Date origCalDate = targetCalendar.getTime(); |
934 | java.util.Date origSessionDate = sessionCalendar.getTime(); |
935 | |
936 | try { |
937 | sessionCalendar.setTime(dt); |
938 | |
939 | targetCalendar.set(Calendar.YEAR, sessionCalendar.get(Calendar.YEAR)); |
940 | targetCalendar.set(Calendar.MONTH, sessionCalendar.get(Calendar.MONTH)); |
941 | targetCalendar.set(Calendar.DAY_OF_MONTH, sessionCalendar.get(Calendar.DAY_OF_MONTH)); |
942 | |
943 | targetCalendar.set(Calendar.HOUR_OF_DAY, sessionCalendar.get(Calendar.HOUR_OF_DAY)); |
944 | targetCalendar.set(Calendar.MINUTE, sessionCalendar.get(Calendar.MINUTE)); |
945 | targetCalendar.set(Calendar.SECOND, sessionCalendar.get(Calendar.SECOND)); |
946 | targetCalendar.set(Calendar.MILLISECOND, sessionCalendar.get(Calendar.MILLISECOND)); |
947 | |
948 | return targetCalendar.getTime().getTime(); |
949 | |
950 | } finally { |
951 | sessionCalendar.setTime(origSessionDate); |
952 | targetCalendar.setTime(origCalDate); |
953 | } |
954 | } |
955 | |
956 | // |
957 | // WARN! You must externally synchronize these calendar instances |
958 | // See ResultSet.fastDateCreate() for an example |
959 | // |
960 | final static Date fastDateCreate(boolean useGmtConversion, |
961 | Calendar gmtCalIfNeeded, |
962 | Calendar cal, int year, int month, int day) { |
963 | |
964 | Calendar dateCal = cal; |
965 | |
966 | if (useGmtConversion) { |
967 | |
968 | if (gmtCalIfNeeded == null) { |
969 | gmtCalIfNeeded = Calendar.getInstance(TimeZone.getTimeZone("GMT")); |
970 | } |
971 | gmtCalIfNeeded.clear(); |
972 | |
973 | dateCal = gmtCalIfNeeded; |
974 | } |
975 | |
976 | dateCal.clear(); |
977 | |
978 | // why-oh-why is this different than java.util.date, |
979 | // in the year part, but it still keeps the silly '0' |
980 | // for the start month???? |
981 | dateCal.set(year, month - 1, day, 0, 0, 0); |
982 | |
983 | long dateAsMillis = 0; |
984 | |
985 | try { |
986 | dateAsMillis = dateCal.getTimeInMillis(); |
987 | } catch (IllegalAccessError iae) { |
988 | // Must be on JDK-1.3.1 or older.... |
989 | dateAsMillis = dateCal.getTime().getTime(); |
990 | } |
991 | |
992 | return new Date(dateAsMillis); |
993 | } |
994 | |
995 | final static Time fastTimeCreate(Calendar cal, int hour, int minute, |
996 | int second) { |
997 | cal.clear(); |
998 | |
999 | // Set 'date' to epoch of Jan 1, 1970 |
1000 | cal.set(1970, 0, 1, hour, minute, second); |
1001 | |
1002 | long timeAsMillis = 0; |
1003 | |
1004 | try { |
1005 | timeAsMillis = cal.getTimeInMillis(); |
1006 | } catch (IllegalAccessError iae) { |
1007 | // Must be on JDK-1.3.1 or older.... |
1008 | timeAsMillis = cal.getTime().getTime(); |
1009 | } |
1010 | |
1011 | return new Time(timeAsMillis); |
1012 | } |
1013 | |
1014 | final static Timestamp fastTimestampCreate(boolean useGmtConversion, |
1015 | Calendar gmtCalIfNeeded, |
1016 | Calendar cal, int year, |
1017 | int month, int day, int hour, int minute, int seconds, |
1018 | int secondsPart) { |
1019 | cal.clear(); |
1020 | |
1021 | // why-oh-why is this different than java.util.date, |
1022 | // in the year part, but it still keeps the silly '0' |
1023 | // for the start month???? |
1024 | cal.set(year, month - 1, day, hour, minute, seconds); |
1025 | |
1026 | int offsetDiff = 0; |
1027 | |
1028 | if (useGmtConversion) { |
1029 | int fromOffset = cal.get(Calendar.ZONE_OFFSET) |
1030 | + cal.get(Calendar.DST_OFFSET); |
1031 | |
1032 | if (gmtCalIfNeeded == null) { |
1033 | gmtCalIfNeeded = Calendar.getInstance(TimeZone.getTimeZone("GMT")); |
1034 | } |
1035 | gmtCalIfNeeded.clear(); |
1036 | |
1037 | gmtCalIfNeeded.setTimeInMillis(cal.getTimeInMillis()); |
1038 | |
1039 | int toOffset = gmtCalIfNeeded.get(Calendar.ZONE_OFFSET) |
1040 | + gmtCalIfNeeded.get(Calendar.DST_OFFSET); |
1041 | offsetDiff = fromOffset - toOffset; |
1042 | } |
1043 | |
1044 | long tsAsMillis = 0; |
1045 | |
1046 | try { |
1047 | tsAsMillis = cal.getTimeInMillis(); |
1048 | } catch (IllegalAccessError iae) { |
1049 | // Must be on JDK-1.3.1 or older.... |
1050 | tsAsMillis = cal.getTime().getTime(); |
1051 | } |
1052 | |
1053 | Timestamp ts = new Timestamp(tsAsMillis + offsetDiff); |
1054 | ts.setNanos(secondsPart); |
1055 | |
1056 | return ts; |
1057 | } |
1058 | |
1059 | /** |
1060 | * Returns the 'official' Java timezone name for the given timezone |
1061 | * |
1062 | * @param timezoneStr |
1063 | * the 'common' timezone name |
1064 | * |
1065 | * @return the Java timezone name for the given timezone |
1066 | * |
1067 | * @throws IllegalArgumentException |
1068 | * DOCUMENT ME! |
1069 | */ |
1070 | public static String getCanoncialTimezone(String timezoneStr) { |
1071 | if (timezoneStr == null) { |
1072 | return null; |
1073 | } |
1074 | |
1075 | timezoneStr = timezoneStr.trim(); |
1076 | |
1077 | // Fix windows Daylight/Standard shift JDK doesn't map these (doh) |
1078 | |
1079 | int daylightIndex = StringUtils.indexOfIgnoreCase(timezoneStr, |
1080 | "DAYLIGHT"); |
1081 | |
1082 | if (daylightIndex != -1) { |
1083 | StringBuffer timezoneBuf = new StringBuffer(); |
1084 | timezoneBuf.append(timezoneStr.substring(0, daylightIndex)); |
1085 | timezoneBuf.append("Standard"); |
1086 | timezoneBuf.append(timezoneStr.substring(daylightIndex |
1087 | + "DAYLIGHT".length(), timezoneStr.length())); |
1088 | timezoneStr = timezoneBuf.toString(); |
1089 | } |
1090 | |
1091 | String canonicalTz = (String) TIMEZONE_MAPPINGS.get(timezoneStr); |
1092 | |
1093 | // if we didn't find it, try abbreviated timezones |
1094 | if (canonicalTz == null) { |
1095 | String[] abbreviatedTimezone = (String[]) ABBREVIATED_TIMEZONES |
1096 | .get(timezoneStr); |
1097 | |
1098 | if (abbreviatedTimezone != null) { |
1099 | // If there's only one mapping use that |
1100 | if (abbreviatedTimezone.length == 1) { |
1101 | canonicalTz = abbreviatedTimezone[0]; |
1102 | } else { |
1103 | StringBuffer errorMsg = new StringBuffer( |
1104 | "The server timezone value '"); |
1105 | errorMsg.append(timezoneStr); |
1106 | errorMsg |
1107 | .append("' represents more than one timezone. You must "); |
1108 | errorMsg |
1109 | .append("configure either the server or client to use a "); |
1110 | errorMsg |
1111 | .append("more specifc timezone value if you want to enable "); |
1112 | errorMsg.append("timezone support. The timezones that '"); |
1113 | errorMsg.append(timezoneStr); |
1114 | errorMsg.append("' maps to are: "); |
1115 | errorMsg.append(abbreviatedTimezone[0]); |
1116 | |
1117 | for (int i = 1; i < abbreviatedTimezone.length; i++) { |
1118 | errorMsg.append(", "); |
1119 | errorMsg.append(abbreviatedTimezone[i]); |
1120 | } |
1121 | |
1122 | throw new IllegalArgumentException(errorMsg.toString()); |
1123 | } |
1124 | } |
1125 | } |
1126 | |
1127 | return canonicalTz; |
1128 | } |
1129 | |
1130 | } |