~ubuntu-branches/ubuntu/karmic/mysql-connector-java/karmic

« back to all changes in this revision

Viewing changes to com/mysql/jdbc/TimeUtil.java

  • Committer: Bazaar Package Importer
  • Author(s): Takashi Okamoto
  • Date: 2003-12-30 22:37:53 UTC
  • Revision ID: james.westby@ubuntu.com-20031230223753-5d9n2b0w2ms6puqa
Tags: upstream-3.0.9
ImportĀ upstreamĀ versionĀ 3.0.9

Show diffs side-by-side

added added

removed removed

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