0001: /*
0002: Copyright (C) 2002-2004 MySQL AB
0003:
0004: This program is free software; you can redistribute it and/or modify
0005: it under the terms of version 2 of the GNU General Public License as
0006: published by the Free Software Foundation.
0007:
0008: There are special exceptions to the terms and conditions of the GPL
0009: as it is applied to this software. View the full text of the
0010: exception in file EXCEPTIONS-CONNECTOR-J in the directory of this
0011: software distribution.
0012:
0013: This program is distributed in the hope that it will be useful,
0014: but WITHOUT ANY WARRANTY; without even the implied warranty of
0015: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0016: GNU General Public License for more details.
0017:
0018: You should have received a copy of the GNU General Public License
0019: along with this program; if not, write to the Free Software
0020: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0021:
0022:
0023:
0024: */
0025: package com.mysql.jdbc;
0026:
0027: import java.sql.Date;
0028: import java.sql.SQLException;
0029: import java.sql.Time;
0030: import java.sql.Timestamp;
0031:
0032: import java.util.Calendar;
0033: import java.util.Collections;
0034: import java.util.GregorianCalendar;
0035: import java.util.HashMap;
0036: import java.util.Map;
0037: import java.util.TimeZone;
0038:
0039: /**
0040: * Timezone conversion routines
0041: *
0042: * @author Mark Matthews
0043: */
0044: public class TimeUtil {
0045: static final Map ABBREVIATED_TIMEZONES;
0046:
0047: static final TimeZone GMT_TIMEZONE = TimeZone.getTimeZone("GMT");
0048:
0049: static final Map TIMEZONE_MAPPINGS;
0050:
0051: static {
0052: HashMap tempMap = new HashMap();
0053:
0054: //
0055: // Windows Mappings
0056: //
0057: tempMap.put("Romance", "Europe/Paris");
0058: tempMap.put("Romance Standard Time", "Europe/Paris");
0059: tempMap.put("Warsaw", "Europe/Warsaw");
0060: tempMap.put("Central Europe", "Europe/Prague");
0061: tempMap.put("Central Europe Standard Time", "Europe/Prague");
0062: tempMap.put("Prague Bratislava", "Europe/Prague");
0063: tempMap.put("W. Central Africa Standard Time", "Africa/Luanda");
0064: tempMap.put("FLE", "Europe/Helsinki");
0065: tempMap.put("FLE Standard Time", "Europe/Helsinki");
0066: tempMap.put("GFT", "Europe/Athens");
0067: tempMap.put("GFT Standard Time", "Europe/Athens");
0068: tempMap.put("GTB", "Europe/Athens");
0069: tempMap.put("GTB Standard Time", "Europe/Athens");
0070: tempMap.put("Israel", "Asia/Jerusalem");
0071: tempMap.put("Israel Standard Time", "Asia/Jerusalem");
0072: tempMap.put("Arab", "Asia/Riyadh");
0073: tempMap.put("Arab Standard Time", "Asia/Riyadh");
0074: tempMap.put("Arabic Standard Time", "Asia/Baghdad");
0075: tempMap.put("E. Africa", "Africa/Nairobi");
0076: tempMap.put("E. Africa Standard Time", "Africa/Nairobi");
0077: tempMap.put("Saudi Arabia", "Asia/Riyadh");
0078: tempMap.put("Saudi Arabia Standard Time", "Asia/Riyadh");
0079: tempMap.put("Iran", "Asia/Tehran");
0080: tempMap.put("Iran Standard Time", "Asia/Tehran");
0081: tempMap.put("Afghanistan", "Asia/Kabul");
0082: tempMap.put("Afghanistan Standard Time", "Asia/Kabul");
0083: tempMap.put("India", "Asia/Calcutta");
0084: tempMap.put("India Standard Time", "Asia/Calcutta");
0085: tempMap.put("Myanmar Standard Time", "Asia/Rangoon");
0086: tempMap.put("Nepal Standard Time", "Asia/Katmandu");
0087: tempMap.put("Sri Lanka", "Asia/Colombo");
0088: tempMap.put("Sri Lanka Standard Time", "Asia/Colombo");
0089: tempMap.put("Beijing", "Asia/Shanghai");
0090: tempMap.put("China", "Asia/Shanghai");
0091: tempMap.put("China Standard Time", "Asia/Shanghai");
0092: tempMap.put("AUS Central", "Australia/Darwin");
0093: tempMap.put("AUS Central Standard Time", "Australia/Darwin");
0094: tempMap.put("Cen. Australia", "Australia/Adelaide");
0095: tempMap.put("Cen. Australia Standard Time",
0096: "Australia/Adelaide");
0097: tempMap.put("Vladivostok", "Asia/Vladivostok");
0098: tempMap.put("Vladivostok Standard Time", "Asia/Vladivostok");
0099: tempMap.put("West Pacific", "Pacific/Guam");
0100: tempMap.put("West Pacific Standard Time", "Pacific/Guam");
0101: tempMap.put("E. South America", "America/Sao_Paulo");
0102: tempMap.put("E. South America Standard Time",
0103: "America/Sao_Paulo");
0104: tempMap.put("Greenland Standard Time", "America/Godthab");
0105: tempMap.put("Newfoundland", "America/St_Johns");
0106: tempMap.put("Newfoundland Standard Time", "America/St_Johns");
0107: tempMap.put("Pacific SA", "America/Caracas");
0108: tempMap.put("Pacific SA Standard Time", "America/Caracas");
0109: tempMap.put("SA Western", "America/Caracas");
0110: tempMap.put("SA Western Standard Time", "America/Caracas");
0111: tempMap.put("SA Pacific", "America/Bogota");
0112: tempMap.put("SA Pacific Standard Time", "America/Bogota");
0113: tempMap.put("US Eastern", "America/Indianapolis");
0114: tempMap.put("US Eastern Standard Time", "America/Indianapolis");
0115: tempMap.put("Central America Standard Time", "America/Regina");
0116: tempMap.put("Mexico", "America/Mexico_City");
0117: tempMap.put("Mexico Standard Time", "America/Mexico_City");
0118: tempMap.put("Canada Central", "America/Regina");
0119: tempMap.put("Canada Central Standard Time", "America/Regina");
0120: tempMap.put("US Mountain", "America/Phoenix");
0121: tempMap.put("US Mountain Standard Time", "America/Phoenix");
0122: tempMap.put("GMT", "Europe/London");
0123: tempMap.put("GMT Standard Time", "Europe/London");
0124: tempMap.put("Ekaterinburg", "Asia/Yekaterinburg");
0125: tempMap.put("Ekaterinburg Standard Time", "Asia/Yekaterinburg");
0126: tempMap.put("West Asia", "Asia/Karachi");
0127: tempMap.put("West Asia Standard Time", "Asia/Karachi");
0128: tempMap.put("Central Asia", "Asia/Dhaka");
0129: tempMap.put("Central Asia Standard Time", "Asia/Dhaka");
0130: tempMap
0131: .put("N. Central Asia Standard Time",
0132: "Asia/Novosibirsk");
0133: tempMap.put("Bangkok", "Asia/Bangkok");
0134: tempMap.put("Bangkok Standard Time", "Asia/Bangkok");
0135: tempMap.put("North Asia Standard Time", "Asia/Krasnoyarsk");
0136: tempMap.put("SE Asia", "Asia/Bangkok");
0137: tempMap.put("SE Asia Standard Time", "Asia/Bangkok");
0138: tempMap
0139: .put("North Asia East Standard Time",
0140: "Asia/Ulaanbaatar");
0141: tempMap.put("Singapore", "Asia/Singapore");
0142: tempMap.put("Singapore Standard Time", "Asia/Singapore");
0143: tempMap.put("Taipei", "Asia/Taipei");
0144: tempMap.put("Taipei Standard Time", "Asia/Taipei");
0145: tempMap.put("W. Australia", "Australia/Perth");
0146: tempMap.put("W. Australia Standard Time", "Australia/Perth");
0147: tempMap.put("Korea", "Asia/Seoul");
0148: tempMap.put("Korea Standard Time", "Asia/Seoul");
0149: tempMap.put("Tokyo", "Asia/Tokyo");
0150: tempMap.put("Tokyo Standard Time", "Asia/Tokyo");
0151: tempMap.put("Yakutsk", "Asia/Yakutsk");
0152: tempMap.put("Yakutsk Standard Time", "Asia/Yakutsk");
0153: tempMap.put("Central European", "Europe/Belgrade");
0154: tempMap
0155: .put("Central European Standard Time",
0156: "Europe/Belgrade");
0157: tempMap.put("W. Europe", "Europe/Berlin");
0158: tempMap.put("W. Europe Standard Time", "Europe/Berlin");
0159: tempMap.put("Tasmania", "Australia/Hobart");
0160: tempMap.put("Tasmania Standard Time", "Australia/Hobart");
0161: tempMap.put("AUS Eastern", "Australia/Sydney");
0162: tempMap.put("AUS Eastern Standard Time", "Australia/Sydney");
0163: tempMap.put("E. Australia", "Australia/Brisbane");
0164: tempMap.put("E. Australia Standard Time", "Australia/Brisbane");
0165: tempMap.put("Sydney Standard Time", "Australia/Sydney");
0166: tempMap.put("Central Pacific", "Pacific/Guadalcanal");
0167: tempMap.put("Central Pacific Standard Time",
0168: "Pacific/Guadalcanal");
0169: tempMap.put("Dateline", "Pacific/Majuro");
0170: tempMap.put("Dateline Standard Time", "Pacific/Majuro");
0171: tempMap.put("Fiji", "Pacific/Fiji");
0172: tempMap.put("Fiji Standard Time", "Pacific/Fiji");
0173: tempMap.put("Samoa", "Pacific/Apia");
0174: tempMap.put("Samoa Standard Time", "Pacific/Apia");
0175: tempMap.put("Hawaiian", "Pacific/Honolulu");
0176: tempMap.put("Hawaiian Standard Time", "Pacific/Honolulu");
0177: tempMap.put("Alaskan", "America/Anchorage");
0178: tempMap.put("Alaskan Standard Time", "America/Anchorage");
0179: tempMap.put("Pacific", "America/Los_Angeles");
0180: tempMap.put("Pacific Standard Time", "America/Los_Angeles");
0181: tempMap.put("Mexico Standard Time 2", "America/Chihuahua");
0182: tempMap.put("Mountain", "America/Denver");
0183: tempMap.put("Mountain Standard Time", "America/Denver");
0184: tempMap.put("Central", "America/Chicago");
0185: tempMap.put("Central Standard Time", "America/Chicago");
0186: tempMap.put("Eastern", "America/New_York");
0187: tempMap.put("Eastern Standard Time", "America/New_York");
0188: tempMap.put("E. Europe", "Europe/Bucharest");
0189: tempMap.put("E. Europe Standard Time", "Europe/Bucharest");
0190: tempMap.put("Egypt", "Africa/Cairo");
0191: tempMap.put("Egypt Standard Time", "Africa/Cairo");
0192: tempMap.put("South Africa", "Africa/Harare");
0193: tempMap.put("South Africa Standard Time", "Africa/Harare");
0194: tempMap.put("Atlantic", "America/Halifax");
0195: tempMap.put("Atlantic Standard Time", "America/Halifax");
0196: tempMap.put("SA Eastern", "America/Buenos_Aires");
0197: tempMap.put("SA Eastern Standard Time", "America/Buenos_Aires");
0198: tempMap.put("Mid-Atlantic", "Atlantic/South_Georgia");
0199: tempMap.put("Mid-Atlantic Standard Time",
0200: "Atlantic/South_Georgia");
0201: tempMap.put("Azores", "Atlantic/Azores");
0202: tempMap.put("Azores Standard Time", "Atlantic/Azores");
0203: tempMap.put("Cape Verde Standard Time", "Atlantic/Cape_Verde");
0204: tempMap.put("Russian", "Europe/Moscow");
0205: tempMap.put("Russian Standard Time", "Europe/Moscow");
0206: tempMap.put("New Zealand", "Pacific/Auckland");
0207: tempMap.put("New Zealand Standard Time", "Pacific/Auckland");
0208: tempMap.put("Tonga Standard Time", "Pacific/Tongatapu");
0209: tempMap.put("Arabian", "Asia/Muscat");
0210: tempMap.put("Arabian Standard Time", "Asia/Muscat");
0211: tempMap.put("Caucasus", "Asia/Tbilisi");
0212: tempMap.put("Caucasus Standard Time", "Asia/Tbilisi");
0213: tempMap.put("GMT Standard Time", "GMT");
0214: tempMap.put("Greenwich", "GMT");
0215: tempMap.put("Greenwich Standard Time", "GMT");
0216: tempMap.put("UTC", "GMT");
0217:
0218: TIMEZONE_MAPPINGS = Collections.unmodifiableMap(tempMap);
0219:
0220: //
0221: // Handle abbreviated mappings
0222: //
0223: tempMap = new HashMap();
0224:
0225: tempMap.put("ACST", new String[] { "America/Porto_Acre" });
0226: tempMap.put("ACT", new String[] { "America/Porto_Acre" });
0227: tempMap.put("ADDT", new String[] { "America/Pangnirtung" });
0228: tempMap.put("ADMT", new String[] { "Africa/Asmera",
0229: "Africa/Addis_Ababa" });
0230: tempMap.put("ADT", new String[] { "Atlantic/Bermuda",
0231: "Asia/Baghdad", "America/Thule", "America/Goose_Bay",
0232: "America/Halifax", "America/Glace_Bay",
0233: "America/Pangnirtung", "America/Barbados",
0234: "America/Martinique" });
0235: tempMap.put("AFT", new String[] { "Asia/Kabul" });
0236: tempMap.put("AHDT", new String[] { "America/Anchorage" });
0237: tempMap.put("AHST", new String[] { "America/Anchorage" });
0238: tempMap.put("AHWT", new String[] { "America/Anchorage" });
0239: tempMap.put("AKDT",
0240: new String[] { "America/Juneau", "America/Yakutat",
0241: "America/Anchorage", "America/Nome" });
0242: tempMap.put("AKST", new String[] { "Asia/Aqtobe",
0243: "America/Juneau", "America/Yakutat",
0244: "America/Anchorage", "America/Nome" });
0245: tempMap.put("AKT", new String[] { "Asia/Aqtobe" });
0246: tempMap.put("AKTST", new String[] { "Asia/Aqtobe" });
0247: tempMap.put("AKWT",
0248: new String[] { "America/Juneau", "America/Yakutat",
0249: "America/Anchorage", "America/Nome" });
0250: tempMap.put("ALMST", new String[] { "Asia/Almaty" });
0251: tempMap.put("ALMT", new String[] { "Asia/Almaty" });
0252: tempMap.put("AMST", new String[] { "Asia/Yerevan",
0253: "America/Cuiaba", "America/Porto_Velho",
0254: "America/Boa_Vista", "America/Manaus" });
0255: tempMap.put("AMT", new String[] { "Europe/Athens",
0256: "Europe/Amsterdam", "Asia/Yerevan", "Africa/Asmera",
0257: "America/Cuiaba", "America/Porto_Velho",
0258: "America/Boa_Vista", "America/Manaus",
0259: "America/Asuncion" });
0260: tempMap.put("ANAMT", new String[] { "Asia/Anadyr" });
0261: tempMap.put("ANAST", new String[] { "Asia/Anadyr" });
0262: tempMap.put("ANAT", new String[] { "Asia/Anadyr" });
0263: tempMap.put("ANT", new String[] { "America/Aruba",
0264: "America/Curacao" });
0265: tempMap.put("AQTST",
0266: new String[] { "Asia/Aqtobe", "Asia/Aqtau" });
0267: tempMap.put("AQTT",
0268: new String[] { "Asia/Aqtobe", "Asia/Aqtau" });
0269: tempMap.put("ARST", new String[] { "Antarctica/Palmer",
0270: "America/Buenos_Aires", "America/Rosario",
0271: "America/Cordoba", "America/Jujuy",
0272: "America/Catamarca", "America/Mendoza" });
0273: tempMap.put("ART", new String[] { "Antarctica/Palmer",
0274: "America/Buenos_Aires", "America/Rosario",
0275: "America/Cordoba", "America/Jujuy",
0276: "America/Catamarca", "America/Mendoza" });
0277: tempMap.put("ASHST", new String[] { "Asia/Ashkhabad" });
0278: tempMap.put("ASHT", new String[] { "Asia/Ashkhabad" });
0279: tempMap.put("AST", new String[] { "Atlantic/Bermuda",
0280: "Asia/Bahrain", "Asia/Baghdad", "Asia/Kuwait",
0281: "Asia/Qatar", "Asia/Riyadh", "Asia/Aden",
0282: "America/Thule", "America/Goose_Bay",
0283: "America/Halifax", "America/Glace_Bay",
0284: "America/Pangnirtung", "America/Anguilla",
0285: "America/Antigua", "America/Barbados",
0286: "America/Dominica", "America/Santo_Domingo",
0287: "America/Grenada", "America/Guadeloupe",
0288: "America/Martinique", "America/Montserrat",
0289: "America/Puerto_Rico", "America/St_Kitts",
0290: "America/St_Lucia", "America/Miquelon",
0291: "America/St_Vincent", "America/Tortola",
0292: "America/St_Thomas", "America/Aruba",
0293: "America/Curacao", "America/Port_of_Spain" });
0294: tempMap.put("AWT", new String[] { "America/Puerto_Rico" });
0295: tempMap.put("AZOST", new String[] { "Atlantic/Azores" });
0296: tempMap.put("AZOT", new String[] { "Atlantic/Azores" });
0297: tempMap.put("AZST", new String[] { "Asia/Baku" });
0298: tempMap.put("AZT", new String[] { "Asia/Baku" });
0299: tempMap.put("BAKST", new String[] { "Asia/Baku" });
0300: tempMap.put("BAKT", new String[] { "Asia/Baku" });
0301: tempMap.put("BDT", new String[] { "Asia/Dacca", "America/Nome",
0302: "America/Adak" });
0303: tempMap.put("BEAT", new String[] { "Africa/Nairobi",
0304: "Africa/Mogadishu", "Africa/Kampala" });
0305: tempMap.put("BEAUT", new String[] { "Africa/Nairobi",
0306: "Africa/Dar_es_Salaam", "Africa/Kampala" });
0307: tempMap.put("BMT", new String[] { "Europe/Brussels",
0308: "Europe/Chisinau", "Europe/Tiraspol",
0309: "Europe/Bucharest", "Europe/Zurich", "Asia/Baghdad",
0310: "Asia/Bangkok", "Africa/Banjul", "America/Barbados",
0311: "America/Bogota" });
0312: tempMap.put("BNT", new String[] { "Asia/Brunei" });
0313: tempMap.put("BORT", new String[] { "Asia/Ujung_Pandang",
0314: "Asia/Kuching" });
0315: tempMap.put("BOST", new String[] { "America/La_Paz" });
0316: tempMap.put("BOT", new String[] { "America/La_Paz" });
0317: tempMap.put("BRST", new String[] { "America/Belem",
0318: "America/Fortaleza", "America/Araguaina",
0319: "America/Maceio", "America/Sao_Paulo" });
0320: tempMap.put("BRT", new String[] { "America/Belem",
0321: "America/Fortaleza", "America/Araguaina",
0322: "America/Maceio", "America/Sao_Paulo" });
0323: tempMap.put("BST", new String[] { "Europe/London",
0324: "Europe/Belfast", "Europe/Dublin", "Europe/Gibraltar",
0325: "Pacific/Pago_Pago", "Pacific/Midway", "America/Nome",
0326: "America/Adak" });
0327: tempMap.put("BTT", new String[] { "Asia/Thimbu" });
0328: tempMap.put("BURT", new String[] { "Asia/Dacca",
0329: "Asia/Rangoon", "Asia/Calcutta" });
0330: tempMap.put("BWT", new String[] { "America/Nome",
0331: "America/Adak" });
0332: tempMap.put("CANT", new String[] { "Atlantic/Canary" });
0333: tempMap.put("CAST", new String[] { "Africa/Gaborone",
0334: "Africa/Khartoum" });
0335: tempMap.put("CAT", new String[] { "Africa/Gaborone",
0336: "Africa/Bujumbura", "Africa/Lubumbashi",
0337: "Africa/Blantyre", "Africa/Maputo", "Africa/Windhoek",
0338: "Africa/Kigali", "Africa/Khartoum", "Africa/Lusaka",
0339: "Africa/Harare", "America/Anchorage" });
0340: tempMap.put("CCT", new String[] { "Indian/Cocos" });
0341: tempMap.put("CDDT", new String[] { "America/Rankin_Inlet" });
0342: tempMap.put("CDT", new String[] { "Asia/Harbin",
0343: "Asia/Shanghai", "Asia/Chungking", "Asia/Urumqi",
0344: "Asia/Kashgar", "Asia/Taipei", "Asia/Macao",
0345: "America/Chicago", "America/Indianapolis",
0346: "America/Indiana/Marengo", "America/Indiana/Knox",
0347: "America/Indiana/Vevay", "America/Louisville",
0348: "America/Menominee", "America/Rainy_River",
0349: "America/Winnipeg", "America/Pangnirtung",
0350: "America/Iqaluit", "America/Rankin_Inlet",
0351: "America/Cambridge_Bay", "America/Cancun",
0352: "America/Mexico_City", "America/Chihuahua",
0353: "America/Belize", "America/Costa_Rica",
0354: "America/Havana", "America/El_Salvador",
0355: "America/Guatemala", "America/Tegucigalpa",
0356: "America/Managua" });
0357: tempMap.put("CEST", new String[] { "Europe/Tirane",
0358: "Europe/Andorra", "Europe/Vienna", "Europe/Minsk",
0359: "Europe/Brussels", "Europe/Sofia", "Europe/Prague",
0360: "Europe/Copenhagen", "Europe/Tallinn", "Europe/Berlin",
0361: "Europe/Gibraltar", "Europe/Athens", "Europe/Budapest",
0362: "Europe/Rome", "Europe/Riga", "Europe/Vaduz",
0363: "Europe/Vilnius", "Europe/Luxembourg", "Europe/Malta",
0364: "Europe/Chisinau", "Europe/Tiraspol", "Europe/Monaco",
0365: "Europe/Amsterdam", "Europe/Oslo", "Europe/Warsaw",
0366: "Europe/Lisbon", "Europe/Kaliningrad", "Europe/Madrid",
0367: "Europe/Stockholm", "Europe/Zurich", "Europe/Kiev",
0368: "Europe/Uzhgorod", "Europe/Zaporozhye",
0369: "Europe/Simferopol", "Europe/Belgrade",
0370: "Africa/Algiers", "Africa/Tripoli", "Africa/Tunis",
0371: "Africa/Ceuta" });
0372: tempMap.put("CET", new String[] { "Europe/Tirane",
0373: "Europe/Andorra", "Europe/Vienna", "Europe/Minsk",
0374: "Europe/Brussels", "Europe/Sofia", "Europe/Prague",
0375: "Europe/Copenhagen", "Europe/Tallinn", "Europe/Berlin",
0376: "Europe/Gibraltar", "Europe/Athens", "Europe/Budapest",
0377: "Europe/Rome", "Europe/Riga", "Europe/Vaduz",
0378: "Europe/Vilnius", "Europe/Luxembourg", "Europe/Malta",
0379: "Europe/Chisinau", "Europe/Tiraspol", "Europe/Monaco",
0380: "Europe/Amsterdam", "Europe/Oslo", "Europe/Warsaw",
0381: "Europe/Lisbon", "Europe/Kaliningrad", "Europe/Madrid",
0382: "Europe/Stockholm", "Europe/Zurich", "Europe/Kiev",
0383: "Europe/Uzhgorod", "Europe/Zaporozhye",
0384: "Europe/Simferopol", "Europe/Belgrade",
0385: "Africa/Algiers", "Africa/Tripoli",
0386: "Africa/Casablanca", "Africa/Tunis", "Africa/Ceuta" });
0387: tempMap.put("CGST", new String[] { "America/Scoresbysund" });
0388: tempMap.put("CGT", new String[] { "America/Scoresbysund" });
0389: tempMap.put("CHDT", new String[] { "America/Belize" });
0390: tempMap.put("CHUT", new String[] { "Asia/Chungking" });
0391: tempMap.put("CJT", new String[] { "Asia/Tokyo" });
0392: tempMap.put("CKHST", new String[] { "Pacific/Rarotonga" });
0393: tempMap.put("CKT", new String[] { "Pacific/Rarotonga" });
0394: tempMap.put("CLST", new String[] { "Antarctica/Palmer",
0395: "America/Santiago" });
0396: tempMap.put("CLT", new String[] { "Antarctica/Palmer",
0397: "America/Santiago" });
0398: tempMap.put("CMT", new String[] { "Europe/Copenhagen",
0399: "Europe/Chisinau", "Europe/Tiraspol",
0400: "America/St_Lucia", "America/Buenos_Aires",
0401: "America/Rosario", "America/Cordoba", "America/Jujuy",
0402: "America/Catamarca", "America/Mendoza",
0403: "America/Caracas" });
0404: tempMap.put("COST", new String[] { "America/Bogota" });
0405: tempMap.put("COT", new String[] { "America/Bogota" });
0406: tempMap.put("CST", new String[] { "Asia/Harbin",
0407: "Asia/Shanghai", "Asia/Chungking", "Asia/Urumqi",
0408: "Asia/Kashgar", "Asia/Taipei", "Asia/Macao",
0409: "Asia/Jayapura", "Australia/Darwin",
0410: "Australia/Adelaide", "Australia/Broken_Hill",
0411: "America/Chicago", "America/Indianapolis",
0412: "America/Indiana/Marengo", "America/Indiana/Knox",
0413: "America/Indiana/Vevay", "America/Louisville",
0414: "America/Detroit", "America/Menominee",
0415: "America/Rainy_River", "America/Winnipeg",
0416: "America/Regina", "America/Swift_Current",
0417: "America/Pangnirtung", "America/Iqaluit",
0418: "America/Rankin_Inlet", "America/Cambridge_Bay",
0419: "America/Cancun", "America/Mexico_City",
0420: "America/Chihuahua", "America/Hermosillo",
0421: "America/Mazatlan", "America/Belize",
0422: "America/Costa_Rica", "America/Havana",
0423: "America/El_Salvador", "America/Guatemala",
0424: "America/Tegucigalpa", "America/Managua" });
0425: tempMap.put("CUT", new String[] { "Europe/Zaporozhye" });
0426: tempMap.put("CVST", new String[] { "Atlantic/Cape_Verde" });
0427: tempMap.put("CVT", new String[] { "Atlantic/Cape_Verde" });
0428: tempMap.put("CWT", new String[] { "America/Chicago",
0429: "America/Indianapolis", "America/Indiana/Marengo",
0430: "America/Indiana/Knox", "America/Indiana/Vevay",
0431: "America/Louisville", "America/Menominee" });
0432: tempMap.put("CXT", new String[] { "Indian/Christmas" });
0433: tempMap.put("DACT", new String[] { "Asia/Dacca" });
0434: tempMap.put("DAVT", new String[] { "Antarctica/Davis" });
0435: tempMap.put("DDUT",
0436: new String[] { "Antarctica/DumontDUrville" });
0437: tempMap.put("DFT",
0438: new String[] { "Europe/Oslo", "Europe/Paris" });
0439: tempMap.put("DMT", new String[] { "Europe/Belfast",
0440: "Europe/Dublin" });
0441: tempMap.put("DUSST", new String[] { "Asia/Dushanbe" });
0442: tempMap.put("DUST", new String[] { "Asia/Dushanbe" });
0443: tempMap.put("EASST", new String[] { "Pacific/Easter" });
0444: tempMap.put("EAST", new String[] { "Indian/Antananarivo",
0445: "Pacific/Easter" });
0446: tempMap.put("EAT", new String[] { "Indian/Comoro",
0447: "Indian/Antananarivo", "Indian/Mayotte",
0448: "Africa/Djibouti", "Africa/Asmera",
0449: "Africa/Addis_Ababa", "Africa/Nairobi",
0450: "Africa/Mogadishu", "Africa/Khartoum",
0451: "Africa/Dar_es_Salaam", "Africa/Kampala" });
0452: tempMap.put("ECT", new String[] { "Pacific/Galapagos",
0453: "America/Guayaquil" });
0454: tempMap.put("EDDT", new String[] { "America/Iqaluit" });
0455: tempMap.put("EDT", new String[] { "America/New_York",
0456: "America/Indianapolis", "America/Indiana/Marengo",
0457: "America/Indiana/Vevay", "America/Louisville",
0458: "America/Detroit", "America/Montreal",
0459: "America/Thunder_Bay", "America/Nipigon",
0460: "America/Pangnirtung", "America/Iqaluit",
0461: "America/Cancun", "America/Nassau",
0462: "America/Santo_Domingo", "America/Port-au-Prince",
0463: "America/Jamaica", "America/Grand_Turk" });
0464: tempMap.put("EEMT", new String[] { "Europe/Minsk",
0465: "Europe/Chisinau", "Europe/Tiraspol",
0466: "Europe/Kaliningrad", "Europe/Moscow" });
0467: tempMap.put("EEST", new String[] { "Europe/Minsk",
0468: "Europe/Sofia", "Europe/Tallinn", "Europe/Helsinki",
0469: "Europe/Athens", "Europe/Riga", "Europe/Vilnius",
0470: "Europe/Chisinau", "Europe/Tiraspol", "Europe/Warsaw",
0471: "Europe/Bucharest", "Europe/Kaliningrad",
0472: "Europe/Moscow", "Europe/Istanbul", "Europe/Kiev",
0473: "Europe/Uzhgorod", "Europe/Zaporozhye", "Asia/Nicosia",
0474: "Asia/Amman", "Asia/Beirut", "Asia/Gaza",
0475: "Asia/Damascus", "Africa/Cairo" });
0476: tempMap.put("EET", new String[] { "Europe/Minsk",
0477: "Europe/Sofia", "Europe/Tallinn", "Europe/Helsinki",
0478: "Europe/Athens", "Europe/Riga", "Europe/Vilnius",
0479: "Europe/Chisinau", "Europe/Tiraspol", "Europe/Warsaw",
0480: "Europe/Bucharest", "Europe/Kaliningrad",
0481: "Europe/Moscow", "Europe/Istanbul", "Europe/Kiev",
0482: "Europe/Uzhgorod", "Europe/Zaporozhye",
0483: "Europe/Simferopol", "Asia/Nicosia", "Asia/Amman",
0484: "Asia/Beirut", "Asia/Gaza", "Asia/Damascus",
0485: "Africa/Cairo", "Africa/Tripoli" });
0486: tempMap.put("EGST", new String[] { "America/Scoresbysund" });
0487: tempMap.put("EGT", new String[] { "Atlantic/Jan_Mayen",
0488: "America/Scoresbysund" });
0489: tempMap.put("EHDT", new String[] { "America/Santo_Domingo" });
0490: tempMap.put("EST", new String[] { "Australia/Brisbane",
0491: "Australia/Lindeman", "Australia/Hobart",
0492: "Australia/Melbourne", "Australia/Sydney",
0493: "Australia/Broken_Hill", "Australia/Lord_Howe",
0494: "America/New_York", "America/Chicago",
0495: "America/Indianapolis", "America/Indiana/Marengo",
0496: "America/Indiana/Knox", "America/Indiana/Vevay",
0497: "America/Louisville", "America/Detroit",
0498: "America/Menominee", "America/Montreal",
0499: "America/Thunder_Bay", "America/Nipigon",
0500: "America/Pangnirtung", "America/Iqaluit",
0501: "America/Cancun", "America/Antigua", "America/Nassau",
0502: "America/Cayman", "America/Santo_Domingo",
0503: "America/Port-au-Prince", "America/Jamaica",
0504: "America/Managua", "America/Panama",
0505: "America/Grand_Turk" });
0506: tempMap.put("EWT", new String[] { "America/New_York",
0507: "America/Indianapolis", "America/Indiana/Marengo",
0508: "America/Indiana/Vevay", "America/Louisville",
0509: "America/Detroit", "America/Jamaica" });
0510: tempMap.put("FFMT", new String[] { "America/Martinique" });
0511: tempMap.put("FJST", new String[] { "Pacific/Fiji" });
0512: tempMap.put("FJT", new String[] { "Pacific/Fiji" });
0513: tempMap.put("FKST", new String[] { "Atlantic/Stanley" });
0514: tempMap.put("FKT", new String[] { "Atlantic/Stanley" });
0515: tempMap.put("FMT", new String[] { "Atlantic/Madeira",
0516: "Africa/Freetown" });
0517: tempMap.put("FNST", new String[] { "America/Noronha" });
0518: tempMap.put("FNT", new String[] { "America/Noronha" });
0519: tempMap.put("FRUST", new String[] { "Asia/Bishkek" });
0520: tempMap.put("FRUT", new String[] { "Asia/Bishkek" });
0521: tempMap.put("GALT", new String[] { "Pacific/Galapagos" });
0522: tempMap.put("GAMT", new String[] { "Pacific/Gambier" });
0523: tempMap.put("GBGT", new String[] { "America/Guyana" });
0524: tempMap.put("GEST", new String[] { "Asia/Tbilisi" });
0525: tempMap.put("GET", new String[] { "Asia/Tbilisi" });
0526: tempMap.put("GFT", new String[] { "America/Cayenne" });
0527: tempMap.put("GHST", new String[] { "Africa/Accra" });
0528: tempMap.put("GILT", new String[] { "Pacific/Tarawa" });
0529: tempMap.put("GMT", new String[] { "Atlantic/St_Helena",
0530: "Atlantic/Reykjavik", "Europe/London",
0531: "Europe/Belfast", "Europe/Dublin", "Europe/Gibraltar",
0532: "Africa/Porto-Novo", "Africa/Ouagadougou",
0533: "Africa/Abidjan", "Africa/Malabo", "Africa/Banjul",
0534: "Africa/Accra", "Africa/Conakry", "Africa/Bissau",
0535: "Africa/Monrovia", "Africa/Bamako", "Africa/Timbuktu",
0536: "Africa/Nouakchott", "Africa/Niamey",
0537: "Africa/Sao_Tome", "Africa/Dakar", "Africa/Freetown",
0538: "Africa/Lome" });
0539: tempMap.put("GST", new String[] { "Atlantic/South_Georgia",
0540: "Asia/Bahrain", "Asia/Muscat", "Asia/Qatar",
0541: "Asia/Dubai", "Pacific/Guam" });
0542: tempMap.put("GYT", new String[] { "America/Guyana" });
0543: tempMap.put("HADT", new String[] { "America/Adak" });
0544: tempMap.put("HART", new String[] { "Asia/Harbin" });
0545: tempMap.put("HAST", new String[] { "America/Adak" });
0546: tempMap.put("HAWT", new String[] { "America/Adak" });
0547: tempMap.put("HDT", new String[] { "Pacific/Honolulu" });
0548: tempMap.put("HKST", new String[] { "Asia/Hong_Kong" });
0549: tempMap.put("HKT", new String[] { "Asia/Hong_Kong" });
0550: tempMap.put("HMT", new String[] { "Atlantic/Azores",
0551: "Europe/Helsinki", "Asia/Dacca", "Asia/Calcutta",
0552: "America/Havana" });
0553: tempMap.put("HOVST", new String[] { "Asia/Hovd" });
0554: tempMap.put("HOVT", new String[] { "Asia/Hovd" });
0555: tempMap.put("HST", new String[] { "Pacific/Johnston",
0556: "Pacific/Honolulu" });
0557: tempMap.put("HWT", new String[] { "Pacific/Honolulu" });
0558: tempMap.put("ICT", new String[] { "Asia/Phnom_Penh",
0559: "Asia/Vientiane", "Asia/Bangkok", "Asia/Saigon" });
0560: tempMap.put("IDDT", new String[] { "Asia/Jerusalem",
0561: "Asia/Gaza" });
0562: tempMap.put("IDT",
0563: new String[] { "Asia/Jerusalem", "Asia/Gaza" });
0564: tempMap.put("IHST", new String[] { "Asia/Colombo" });
0565: tempMap.put("IMT", new String[] { "Europe/Sofia",
0566: "Europe/Istanbul", "Asia/Irkutsk" });
0567: tempMap.put("IOT", new String[] { "Indian/Chagos" });
0568: tempMap.put("IRKMT", new String[] { "Asia/Irkutsk" });
0569: tempMap.put("IRKST", new String[] { "Asia/Irkutsk" });
0570: tempMap.put("IRKT", new String[] { "Asia/Irkutsk" });
0571: tempMap.put("IRST", new String[] { "Asia/Tehran" });
0572: tempMap.put("IRT", new String[] { "Asia/Tehran" });
0573: tempMap.put("ISST", new String[] { "Atlantic/Reykjavik" });
0574: tempMap.put("IST", new String[] { "Atlantic/Reykjavik",
0575: "Europe/Belfast", "Europe/Dublin", "Asia/Dacca",
0576: "Asia/Thimbu", "Asia/Calcutta", "Asia/Jerusalem",
0577: "Asia/Katmandu", "Asia/Karachi", "Asia/Gaza",
0578: "Asia/Colombo" });
0579: tempMap.put("JAYT", new String[] { "Asia/Jayapura" });
0580: tempMap.put("JMT", new String[] { "Atlantic/St_Helena",
0581: "Asia/Jerusalem" });
0582: tempMap.put("JST", new String[] { "Asia/Rangoon", "Asia/Dili",
0583: "Asia/Ujung_Pandang", "Asia/Tokyo",
0584: "Asia/Kuala_Lumpur", "Asia/Kuching", "Asia/Manila",
0585: "Asia/Singapore", "Pacific/Nauru" });
0586: tempMap.put("KART", new String[] { "Asia/Karachi" });
0587: tempMap.put("KAST", new String[] { "Asia/Kashgar" });
0588: tempMap.put("KDT", new String[] { "Asia/Seoul" });
0589: tempMap.put("KGST", new String[] { "Asia/Bishkek" });
0590: tempMap.put("KGT", new String[] { "Asia/Bishkek" });
0591: tempMap.put("KMT", new String[] { "Europe/Vilnius",
0592: "Europe/Kiev", "America/Cayman", "America/Jamaica",
0593: "America/St_Vincent", "America/Grand_Turk" });
0594: tempMap.put("KOST", new String[] { "Pacific/Kosrae" });
0595: tempMap.put("KRAMT", new String[] { "Asia/Krasnoyarsk" });
0596: tempMap.put("KRAST", new String[] { "Asia/Krasnoyarsk" });
0597: tempMap.put("KRAT", new String[] { "Asia/Krasnoyarsk" });
0598: tempMap.put("KST", new String[] { "Asia/Seoul",
0599: "Asia/Pyongyang" });
0600: tempMap.put("KUYMT", new String[] { "Europe/Samara" });
0601: tempMap.put("KUYST", new String[] { "Europe/Samara" });
0602: tempMap.put("KUYT", new String[] { "Europe/Samara" });
0603: tempMap.put("KWAT", new String[] { "Pacific/Kwajalein" });
0604: tempMap.put("LHST", new String[] { "Australia/Lord_Howe" });
0605: tempMap.put("LINT", new String[] { "Pacific/Kiritimati" });
0606: tempMap.put("LKT", new String[] { "Asia/Colombo" });
0607: tempMap.put("LPMT", new String[] { "America/La_Paz" });
0608: tempMap.put("LRT", new String[] { "Africa/Monrovia" });
0609: tempMap.put("LST", new String[] { "Europe/Riga" });
0610: tempMap.put("M", new String[] { "Europe/Moscow" });
0611: tempMap.put("MADST", new String[] { "Atlantic/Madeira" });
0612: tempMap.put("MAGMT", new String[] { "Asia/Magadan" });
0613: tempMap.put("MAGST", new String[] { "Asia/Magadan" });
0614: tempMap.put("MAGT", new String[] { "Asia/Magadan" });
0615: tempMap.put("MALT", new String[] { "Asia/Kuala_Lumpur",
0616: "Asia/Singapore" });
0617: tempMap.put("MART", new String[] { "Pacific/Marquesas" });
0618: tempMap.put("MAWT", new String[] { "Antarctica/Mawson" });
0619: tempMap.put("MDDT", new String[] { "America/Cambridge_Bay",
0620: "America/Yellowknife", "America/Inuvik" });
0621: tempMap.put("MDST", new String[] { "Europe/Moscow" });
0622: tempMap.put("MDT", new String[] { "America/Denver",
0623: "America/Phoenix", "America/Boise", "America/Regina",
0624: "America/Swift_Current", "America/Edmonton",
0625: "America/Cambridge_Bay", "America/Yellowknife",
0626: "America/Inuvik", "America/Chihuahua",
0627: "America/Hermosillo", "America/Mazatlan" });
0628: tempMap.put("MET", new String[] { "Europe/Tirane",
0629: "Europe/Andorra", "Europe/Vienna", "Europe/Minsk",
0630: "Europe/Brussels", "Europe/Sofia", "Europe/Prague",
0631: "Europe/Copenhagen", "Europe/Tallinn", "Europe/Berlin",
0632: "Europe/Gibraltar", "Europe/Athens", "Europe/Budapest",
0633: "Europe/Rome", "Europe/Riga", "Europe/Vaduz",
0634: "Europe/Vilnius", "Europe/Luxembourg", "Europe/Malta",
0635: "Europe/Chisinau", "Europe/Tiraspol", "Europe/Monaco",
0636: "Europe/Amsterdam", "Europe/Oslo", "Europe/Warsaw",
0637: "Europe/Lisbon", "Europe/Kaliningrad", "Europe/Madrid",
0638: "Europe/Stockholm", "Europe/Zurich", "Europe/Kiev",
0639: "Europe/Uzhgorod", "Europe/Zaporozhye",
0640: "Europe/Simferopol", "Europe/Belgrade",
0641: "Africa/Algiers", "Africa/Tripoli",
0642: "Africa/Casablanca", "Africa/Tunis", "Africa/Ceuta" });
0643: tempMap.put("MHT", new String[] { "Pacific/Majuro",
0644: "Pacific/Kwajalein" });
0645: tempMap.put("MMT", new String[] { "Indian/Maldives",
0646: "Europe/Minsk", "Europe/Moscow", "Asia/Rangoon",
0647: "Asia/Ujung_Pandang", "Asia/Colombo", "Pacific/Easter",
0648: "Africa/Monrovia", "America/Managua",
0649: "America/Montevideo" });
0650: tempMap.put("MOST", new String[] { "Asia/Macao" });
0651: tempMap.put("MOT", new String[] { "Asia/Macao" });
0652: tempMap.put("MPT", new String[] { "Pacific/Saipan" });
0653: tempMap.put("MSK", new String[] { "Europe/Minsk",
0654: "Europe/Tallinn", "Europe/Riga", "Europe/Vilnius",
0655: "Europe/Chisinau", "Europe/Kiev", "Europe/Uzhgorod",
0656: "Europe/Zaporozhye", "Europe/Simferopol" });
0657: tempMap.put("MST", new String[] { "Europe/Moscow",
0658: "America/Denver", "America/Phoenix", "America/Boise",
0659: "America/Regina", "America/Swift_Current",
0660: "America/Edmonton", "America/Dawson_Creek",
0661: "America/Cambridge_Bay", "America/Yellowknife",
0662: "America/Inuvik", "America/Mexico_City",
0663: "America/Chihuahua", "America/Hermosillo",
0664: "America/Mazatlan", "America/Tijuana" });
0665: tempMap.put("MUT", new String[] { "Indian/Mauritius" });
0666: tempMap.put("MVT", new String[] { "Indian/Maldives" });
0667: tempMap.put("MWT", new String[] { "America/Denver",
0668: "America/Phoenix", "America/Boise" });
0669: tempMap.put("MYT", new String[] { "Asia/Kuala_Lumpur",
0670: "Asia/Kuching" });
0671: tempMap.put("NCST", new String[] { "Pacific/Noumea" });
0672: tempMap.put("NCT", new String[] { "Pacific/Noumea" });
0673: tempMap.put("NDT",
0674: new String[] { "America/Nome", "America/Adak",
0675: "America/St_Johns", "America/Goose_Bay" });
0676: tempMap.put("NEGT", new String[] { "America/Paramaribo" });
0677: tempMap.put("NFT", new String[] { "Europe/Paris",
0678: "Europe/Oslo", "Pacific/Norfolk" });
0679: tempMap.put("NMT", new String[] { "Pacific/Norfolk" });
0680: tempMap.put("NOVMT", new String[] { "Asia/Novosibirsk" });
0681: tempMap.put("NOVST", new String[] { "Asia/Novosibirsk" });
0682: tempMap.put("NOVT", new String[] { "Asia/Novosibirsk" });
0683: tempMap.put("NPT", new String[] { "Asia/Katmandu" });
0684: tempMap.put("NRT", new String[] { "Pacific/Nauru" });
0685: tempMap.put("NST",
0686: new String[] { "Europe/Amsterdam", "Pacific/Pago_Pago",
0687: "Pacific/Midway", "America/Nome",
0688: "America/Adak", "America/St_Johns",
0689: "America/Goose_Bay" });
0690: tempMap.put("NUT", new String[] { "Pacific/Niue" });
0691: tempMap.put("NWT", new String[] { "America/Nome",
0692: "America/Adak" });
0693: tempMap.put("NZDT", new String[] { "Antarctica/McMurdo" });
0694: tempMap.put("NZHDT", new String[] { "Pacific/Auckland" });
0695: tempMap.put("NZST", new String[] { "Antarctica/McMurdo",
0696: "Pacific/Auckland" });
0697: tempMap.put("OMSMT", new String[] { "Asia/Omsk" });
0698: tempMap.put("OMSST", new String[] { "Asia/Omsk" });
0699: tempMap.put("OMST", new String[] { "Asia/Omsk" });
0700: tempMap.put("PDDT", new String[] { "America/Inuvik",
0701: "America/Whitehorse", "America/Dawson" });
0702: tempMap.put("PDT", new String[] { "America/Los_Angeles",
0703: "America/Juneau", "America/Boise", "America/Vancouver",
0704: "America/Dawson_Creek", "America/Inuvik",
0705: "America/Whitehorse", "America/Dawson",
0706: "America/Tijuana" });
0707: tempMap.put("PEST", new String[] { "America/Lima" });
0708: tempMap.put("PET", new String[] { "America/Lima" });
0709: tempMap.put("PETMT", new String[] { "Asia/Kamchatka" });
0710: tempMap.put("PETST", new String[] { "Asia/Kamchatka" });
0711: tempMap.put("PETT", new String[] { "Asia/Kamchatka" });
0712: tempMap.put("PGT", new String[] { "Pacific/Port_Moresby" });
0713: tempMap.put("PHOT", new String[] { "Pacific/Enderbury" });
0714: tempMap.put("PHST", new String[] { "Asia/Manila" });
0715: tempMap.put("PHT", new String[] { "Asia/Manila" });
0716: tempMap.put("PKT", new String[] { "Asia/Karachi" });
0717: tempMap.put("PMDT", new String[] { "America/Miquelon" });
0718: tempMap.put("PMMT", new String[] { "Pacific/Port_Moresby" });
0719: tempMap.put("PMST", new String[] { "America/Miquelon" });
0720: tempMap.put("PMT", new String[] { "Antarctica/DumontDUrville",
0721: "Europe/Prague", "Europe/Paris", "Europe/Monaco",
0722: "Africa/Algiers", "Africa/Tunis", "America/Panama",
0723: "America/Paramaribo" });
0724: tempMap.put("PNT", new String[] { "Pacific/Pitcairn" });
0725: tempMap.put("PONT", new String[] { "Pacific/Ponape" });
0726: tempMap.put("PPMT", new String[] { "America/Port-au-Prince" });
0727: tempMap.put("PST", new String[] { "Pacific/Pitcairn",
0728: "America/Los_Angeles", "America/Juneau",
0729: "America/Boise", "America/Vancouver",
0730: "America/Dawson_Creek", "America/Inuvik",
0731: "America/Whitehorse", "America/Dawson",
0732: "America/Hermosillo", "America/Mazatlan",
0733: "America/Tijuana" });
0734: tempMap.put("PWT", new String[] { "Pacific/Palau",
0735: "America/Los_Angeles", "America/Juneau",
0736: "America/Boise", "America/Tijuana" });
0737: tempMap.put("PYST", new String[] { "America/Asuncion" });
0738: tempMap.put("PYT", new String[] { "America/Asuncion" });
0739: tempMap.put("QMT", new String[] { "America/Guayaquil" });
0740: tempMap.put("RET", new String[] { "Indian/Reunion" });
0741: tempMap.put("RMT", new String[] { "Atlantic/Reykjavik",
0742: "Europe/Rome", "Europe/Riga", "Asia/Rangoon" });
0743: tempMap.put("S", new String[] { "Europe/Moscow" });
0744: tempMap.put("SAMMT", new String[] { "Europe/Samara" });
0745: tempMap.put("SAMST", new String[] { "Europe/Samara",
0746: "Asia/Samarkand" });
0747: tempMap
0748: .put("SAMT", new String[] { "Europe/Samara",
0749: "Asia/Samarkand", "Pacific/Pago_Pago",
0750: "Pacific/Apia" });
0751: tempMap.put("SAST", new String[] { "Africa/Maseru",
0752: "Africa/Windhoek", "Africa/Johannesburg",
0753: "Africa/Mbabane" });
0754: tempMap.put("SBT", new String[] { "Pacific/Guadalcanal" });
0755: tempMap.put("SCT", new String[] { "Indian/Mahe" });
0756: tempMap.put("SDMT", new String[] { "America/Santo_Domingo" });
0757: tempMap.put("SGT", new String[] { "Asia/Singapore" });
0758: tempMap.put("SHEST", new String[] { "Asia/Aqtau" });
0759: tempMap.put("SHET", new String[] { "Asia/Aqtau" });
0760: tempMap.put("SJMT", new String[] { "America/Costa_Rica" });
0761: tempMap.put("SLST", new String[] { "Africa/Freetown" });
0762: tempMap.put("SMT", new String[] { "Atlantic/Stanley",
0763: "Europe/Stockholm", "Europe/Simferopol",
0764: "Asia/Phnom_Penh", "Asia/Vientiane",
0765: "Asia/Kuala_Lumpur", "Asia/Singapore", "Asia/Saigon",
0766: "America/Santiago" });
0767: tempMap.put("SRT", new String[] { "America/Paramaribo" });
0768: tempMap.put("SST", new String[] { "Pacific/Pago_Pago",
0769: "Pacific/Midway" });
0770: tempMap.put("SVEMT", new String[] { "Asia/Yekaterinburg" });
0771: tempMap.put("SVEST", new String[] { "Asia/Yekaterinburg" });
0772: tempMap.put("SVET", new String[] { "Asia/Yekaterinburg" });
0773: tempMap.put("SWAT", new String[] { "Africa/Windhoek" });
0774: tempMap.put("SYOT", new String[] { "Antarctica/Syowa" });
0775: tempMap.put("TAHT", new String[] { "Pacific/Tahiti" });
0776: tempMap.put("TASST", new String[] { "Asia/Samarkand",
0777: "Asia/Tashkent" });
0778: tempMap.put("TAST", new String[] { "Asia/Samarkand",
0779: "Asia/Tashkent" });
0780: tempMap.put("TBIST", new String[] { "Asia/Tbilisi" });
0781: tempMap.put("TBIT", new String[] { "Asia/Tbilisi" });
0782: tempMap.put("TBMT", new String[] { "Asia/Tbilisi" });
0783: tempMap.put("TFT", new String[] { "Indian/Kerguelen" });
0784: tempMap.put("TJT", new String[] { "Asia/Dushanbe" });
0785: tempMap.put("TKT", new String[] { "Pacific/Fakaofo" });
0786: tempMap.put("TMST", new String[] { "Asia/Ashkhabad" });
0787: tempMap.put("TMT", new String[] { "Europe/Tallinn",
0788: "Asia/Tehran", "Asia/Ashkhabad" });
0789: tempMap.put("TOST", new String[] { "Pacific/Tongatapu" });
0790: tempMap.put("TOT", new String[] { "Pacific/Tongatapu" });
0791: tempMap.put("TPT", new String[] { "Asia/Dili" });
0792: tempMap.put("TRST", new String[] { "Europe/Istanbul" });
0793: tempMap.put("TRT", new String[] { "Europe/Istanbul" });
0794: tempMap.put("TRUT", new String[] { "Pacific/Truk" });
0795: tempMap.put("TVT", new String[] { "Pacific/Funafuti" });
0796: tempMap.put("ULAST", new String[] { "Asia/Ulaanbaatar" });
0797: tempMap.put("ULAT", new String[] { "Asia/Ulaanbaatar" });
0798: tempMap.put("URUT", new String[] { "Asia/Urumqi" });
0799: tempMap.put("UYHST", new String[] { "America/Montevideo" });
0800: tempMap.put("UYT", new String[] { "America/Montevideo" });
0801: tempMap.put("UZST", new String[] { "Asia/Samarkand",
0802: "Asia/Tashkent" });
0803: tempMap.put("UZT", new String[] { "Asia/Samarkand",
0804: "Asia/Tashkent" });
0805: tempMap.put("VET", new String[] { "America/Caracas" });
0806: tempMap.put("VLAMT", new String[] { "Asia/Vladivostok" });
0807: tempMap.put("VLAST", new String[] { "Asia/Vladivostok" });
0808: tempMap.put("VLAT", new String[] { "Asia/Vladivostok" });
0809: tempMap.put("VUST", new String[] { "Pacific/Efate" });
0810: tempMap.put("VUT", new String[] { "Pacific/Efate" });
0811: tempMap.put("WAKT", new String[] { "Pacific/Wake" });
0812: tempMap.put("WARST", new String[] { "America/Jujuy",
0813: "America/Mendoza" });
0814: tempMap.put("WART", new String[] { "America/Jujuy",
0815: "America/Mendoza" });
0816: tempMap.put("WAST", new String[] { "Africa/Ndjamena",
0817: "Africa/Windhoek" });
0818: tempMap.put("WAT", new String[] { "Africa/Luanda",
0819: "Africa/Porto-Novo", "Africa/Douala", "Africa/Bangui",
0820: "Africa/Ndjamena", "Africa/Kinshasa",
0821: "Africa/Brazzaville", "Africa/Malabo",
0822: "Africa/Libreville", "Africa/Banjul", "Africa/Conakry",
0823: "Africa/Bissau", "Africa/Bamako", "Africa/Nouakchott",
0824: "Africa/El_Aaiun", "Africa/Windhoek", "Africa/Niamey",
0825: "Africa/Lagos", "Africa/Dakar", "Africa/Freetown" });
0826: tempMap.put("WEST", new String[] { "Atlantic/Faeroe",
0827: "Atlantic/Azores", "Atlantic/Madeira",
0828: "Atlantic/Canary", "Europe/Brussels",
0829: "Europe/Luxembourg", "Europe/Monaco", "Europe/Lisbon",
0830: "Europe/Madrid", "Africa/Algiers", "Africa/Casablanca",
0831: "Africa/Ceuta" });
0832: tempMap.put("WET", new String[] { "Atlantic/Faeroe",
0833: "Atlantic/Azores", "Atlantic/Madeira",
0834: "Atlantic/Canary", "Europe/Andorra", "Europe/Brussels",
0835: "Europe/Luxembourg", "Europe/Monaco", "Europe/Lisbon",
0836: "Europe/Madrid", "Africa/Algiers", "Africa/Casablanca",
0837: "Africa/El_Aaiun", "Africa/Ceuta" });
0838: tempMap.put("WFT", new String[] { "Pacific/Wallis" });
0839: tempMap.put("WGST", new String[] { "America/Godthab" });
0840: tempMap.put("WGT", new String[] { "America/Godthab" });
0841: tempMap.put("WMT", new String[] { "Europe/Vilnius",
0842: "Europe/Warsaw" });
0843: tempMap.put("WST", new String[] { "Antarctica/Casey",
0844: "Pacific/Apia", "Australia/Perth" });
0845: tempMap.put("YAKMT", new String[] { "Asia/Yakutsk" });
0846: tempMap.put("YAKST", new String[] { "Asia/Yakutsk" });
0847: tempMap.put("YAKT", new String[] { "Asia/Yakutsk" });
0848: tempMap.put("YAPT", new String[] { "Pacific/Yap" });
0849: tempMap.put("YDDT", new String[] { "America/Whitehorse",
0850: "America/Dawson" });
0851: tempMap.put("YDT", new String[] { "America/Yakutat",
0852: "America/Whitehorse", "America/Dawson" });
0853: tempMap.put("YEKMT", new String[] { "Asia/Yekaterinburg" });
0854: tempMap.put("YEKST", new String[] { "Asia/Yekaterinburg" });
0855: tempMap.put("YEKT", new String[] { "Asia/Yekaterinburg" });
0856: tempMap.put("YERST", new String[] { "Asia/Yerevan" });
0857: tempMap.put("YERT", new String[] { "Asia/Yerevan" });
0858: tempMap.put("YST", new String[] { "America/Yakutat",
0859: "America/Whitehorse", "America/Dawson" });
0860: tempMap.put("YWT", new String[] { "America/Yakutat" });
0861:
0862: ABBREVIATED_TIMEZONES = Collections.unmodifiableMap(tempMap);
0863: }
0864:
0865: /**
0866: * Change the given times from one timezone to another
0867: *
0868: * @param conn
0869: * the current connection to the MySQL server
0870: * @param t
0871: * the times to change
0872: * @param fromTz
0873: * the timezone to change from
0874: * @param toTz
0875: * the timezone to change to
0876: *
0877: * @return the times changed to the timezone 'toTz'
0878: */
0879: public static Time changeTimezone(ConnectionImpl conn,
0880: Calendar sessionCalendar, Calendar targetCalendar, Time t,
0881: TimeZone fromTz, TimeZone toTz, boolean rollForward) {
0882: if ((conn != null)) {
0883: if (conn.getUseTimezone()
0884: && !conn.getNoTimezoneConversionForTimeType()) {
0885: // Convert the timestamp from GMT to the server's timezone
0886: Calendar fromCal = Calendar.getInstance(fromTz);
0887: fromCal.setTime(t);
0888:
0889: int fromOffset = fromCal.get(Calendar.ZONE_OFFSET)
0890: + fromCal.get(Calendar.DST_OFFSET);
0891: Calendar toCal = Calendar.getInstance(toTz);
0892: toCal.setTime(t);
0893:
0894: int toOffset = toCal.get(Calendar.ZONE_OFFSET)
0895: + toCal.get(Calendar.DST_OFFSET);
0896: int offsetDiff = fromOffset - toOffset;
0897: long toTime = toCal.getTime().getTime();
0898:
0899: if (rollForward
0900: || (conn.isServerTzUTC() && !conn
0901: .isClientTzUTC())) {
0902: toTime += offsetDiff;
0903: } else {
0904: toTime -= offsetDiff;
0905: }
0906:
0907: Time changedTime = new Time(toTime);
0908:
0909: return changedTime;
0910: } else if (conn.getUseJDBCCompliantTimezoneShift()) {
0911: if (targetCalendar != null) {
0912:
0913: Time adjustedTime = new Time(
0914: jdbcCompliantZoneShift(sessionCalendar,
0915: targetCalendar, t));
0916:
0917: return adjustedTime;
0918: }
0919: }
0920: }
0921:
0922: return t;
0923: }
0924:
0925: /**
0926: * Change the given timestamp from one timezone to another
0927: *
0928: * @param conn
0929: * the current connection to the MySQL server
0930: * @param tstamp
0931: * the timestamp to change
0932: * @param fromTz
0933: * the timezone to change from
0934: * @param toTz
0935: * the timezone to change to
0936: *
0937: * @return the timestamp changed to the timezone 'toTz'
0938: */
0939: public static Timestamp changeTimezone(ConnectionImpl conn,
0940: Calendar sessionCalendar, Calendar targetCalendar,
0941: Timestamp tstamp, TimeZone fromTz, TimeZone toTz,
0942: boolean rollForward) {
0943: if ((conn != null)) {
0944: if (conn.getUseTimezone()) {
0945: // Convert the timestamp from GMT to the server's timezone
0946: Calendar fromCal = Calendar.getInstance(fromTz);
0947: fromCal.setTime(tstamp);
0948:
0949: int fromOffset = fromCal.get(Calendar.ZONE_OFFSET)
0950: + fromCal.get(Calendar.DST_OFFSET);
0951: Calendar toCal = Calendar.getInstance(toTz);
0952: toCal.setTime(tstamp);
0953:
0954: int toOffset = toCal.get(Calendar.ZONE_OFFSET)
0955: + toCal.get(Calendar.DST_OFFSET);
0956: int offsetDiff = fromOffset - toOffset;
0957: long toTime = toCal.getTime().getTime();
0958:
0959: if (rollForward
0960: || (conn.isServerTzUTC() && !conn
0961: .isClientTzUTC())) {
0962: toTime += offsetDiff;
0963: } else {
0964: toTime -= offsetDiff;
0965: }
0966:
0967: Timestamp changedTimestamp = new Timestamp(toTime);
0968:
0969: return changedTimestamp;
0970: } else if (conn.getUseJDBCCompliantTimezoneShift()) {
0971: if (targetCalendar != null) {
0972:
0973: Timestamp adjustedTimestamp = new Timestamp(
0974: jdbcCompliantZoneShift(sessionCalendar,
0975: targetCalendar, tstamp));
0976:
0977: adjustedTimestamp.setNanos(tstamp.getNanos());
0978:
0979: return adjustedTimestamp;
0980: }
0981: }
0982: }
0983:
0984: return tstamp;
0985: }
0986:
0987: private static long jdbcCompliantZoneShift(
0988: Calendar sessionCalendar, Calendar targetCalendar,
0989: java.util.Date dt) {
0990: if (sessionCalendar == null) {
0991: sessionCalendar = new GregorianCalendar();
0992: }
0993:
0994: // JDBC spec is not clear whether or not this
0995: // calendar should be immutable, so let's treat
0996: // it like it is, for safety
0997:
0998: java.util.Date origCalDate = targetCalendar.getTime();
0999: java.util.Date origSessionDate = sessionCalendar.getTime();
1000:
1001: try {
1002: sessionCalendar.setTime(dt);
1003:
1004: targetCalendar.set(Calendar.YEAR, sessionCalendar
1005: .get(Calendar.YEAR));
1006: targetCalendar.set(Calendar.MONTH, sessionCalendar
1007: .get(Calendar.MONTH));
1008: targetCalendar.set(Calendar.DAY_OF_MONTH, sessionCalendar
1009: .get(Calendar.DAY_OF_MONTH));
1010:
1011: targetCalendar.set(Calendar.HOUR_OF_DAY, sessionCalendar
1012: .get(Calendar.HOUR_OF_DAY));
1013: targetCalendar.set(Calendar.MINUTE, sessionCalendar
1014: .get(Calendar.MINUTE));
1015: targetCalendar.set(Calendar.SECOND, sessionCalendar
1016: .get(Calendar.SECOND));
1017: targetCalendar.set(Calendar.MILLISECOND, sessionCalendar
1018: .get(Calendar.MILLISECOND));
1019:
1020: return targetCalendar.getTime().getTime();
1021:
1022: } finally {
1023: sessionCalendar.setTime(origSessionDate);
1024: targetCalendar.setTime(origCalDate);
1025: }
1026: }
1027:
1028: //
1029: // WARN! You must externally synchronize these calendar instances
1030: // See ResultSet.fastDateCreate() for an example
1031: //
1032: final static Date fastDateCreate(boolean useGmtConversion,
1033: Calendar gmtCalIfNeeded, Calendar cal, int year, int month,
1034: int day) {
1035:
1036: Calendar dateCal = cal;
1037:
1038: if (useGmtConversion) {
1039:
1040: if (gmtCalIfNeeded == null) {
1041: gmtCalIfNeeded = Calendar.getInstance(TimeZone
1042: .getTimeZone("GMT"));
1043: }
1044: gmtCalIfNeeded.clear();
1045:
1046: dateCal = gmtCalIfNeeded;
1047: }
1048:
1049: dateCal.clear();
1050:
1051: // why-oh-why is this different than java.util.date,
1052: // in the year part, but it still keeps the silly '0'
1053: // for the start month????
1054: dateCal.set(year, month - 1, day, 0, 0, 0);
1055:
1056: long dateAsMillis = 0;
1057:
1058: try {
1059: dateAsMillis = dateCal.getTimeInMillis();
1060: } catch (IllegalAccessError iae) {
1061: // Must be on JDK-1.3.1 or older....
1062: dateAsMillis = dateCal.getTime().getTime();
1063: }
1064:
1065: return new Date(dateAsMillis);
1066: }
1067:
1068: final static Time fastTimeCreate(Calendar cal, int hour,
1069: int minute, int second) throws SQLException {
1070: if (hour < 0 || hour > 23) {
1071: throw SQLError.createSQLException("Illegal hour value '"
1072: + hour + "' for java.sql.Time type in value '"
1073: + timeFormattedString(hour, minute, second) + ".",
1074: SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
1075: }
1076:
1077: if (minute < 0 || minute > 59) {
1078: throw SQLError.createSQLException("Illegal minute value '"
1079: + minute + "'"
1080: + "' for java.sql.Time type in value '"
1081: + timeFormattedString(hour, minute, second) + ".",
1082: SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
1083: }
1084:
1085: if (second < 0 || second > 59) {
1086: throw SQLError.createSQLException("Illegal minute value '"
1087: + second + "'"
1088: + "' for java.sql.Time type in value '"
1089: + timeFormattedString(hour, minute, second) + ".",
1090: SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
1091: }
1092:
1093: cal.clear();
1094:
1095: // Set 'date' to epoch of Jan 1, 1970
1096: cal.set(1970, 0, 1, hour, minute, second);
1097:
1098: long timeAsMillis = 0;
1099:
1100: try {
1101: timeAsMillis = cal.getTimeInMillis();
1102: } catch (IllegalAccessError iae) {
1103: // Must be on JDK-1.3.1 or older....
1104: timeAsMillis = cal.getTime().getTime();
1105: }
1106:
1107: return new Time(timeAsMillis);
1108: }
1109:
1110: final static Timestamp fastTimestampCreate(
1111: boolean useGmtConversion, Calendar gmtCalIfNeeded,
1112: Calendar cal, int year, int month, int day, int hour,
1113: int minute, int seconds, int secondsPart) {
1114: cal.clear();
1115:
1116: // why-oh-why is this different than java.util.date,
1117: // in the year part, but it still keeps the silly '0'
1118: // for the start month????
1119: cal.set(year, month - 1, day, hour, minute, seconds);
1120:
1121: int offsetDiff = 0;
1122:
1123: if (useGmtConversion) {
1124: int fromOffset = cal.get(Calendar.ZONE_OFFSET)
1125: + cal.get(Calendar.DST_OFFSET);
1126:
1127: if (gmtCalIfNeeded == null) {
1128: gmtCalIfNeeded = Calendar.getInstance(TimeZone
1129: .getTimeZone("GMT"));
1130: }
1131: gmtCalIfNeeded.clear();
1132:
1133: gmtCalIfNeeded.setTimeInMillis(cal.getTimeInMillis());
1134:
1135: int toOffset = gmtCalIfNeeded.get(Calendar.ZONE_OFFSET)
1136: + gmtCalIfNeeded.get(Calendar.DST_OFFSET);
1137: offsetDiff = fromOffset - toOffset;
1138: }
1139:
1140: long tsAsMillis = 0;
1141:
1142: try {
1143: tsAsMillis = cal.getTimeInMillis();
1144: } catch (IllegalAccessError iae) {
1145: // Must be on JDK-1.3.1 or older....
1146: tsAsMillis = cal.getTime().getTime();
1147: }
1148:
1149: Timestamp ts = new Timestamp(tsAsMillis + offsetDiff);
1150: ts.setNanos(secondsPart);
1151:
1152: return ts;
1153: }
1154:
1155: /**
1156: * Returns the 'official' Java timezone name for the given timezone
1157: *
1158: * @param timezoneStr
1159: * the 'common' timezone name
1160: *
1161: * @return the Java timezone name for the given timezone
1162: *
1163: * @throws IllegalArgumentException
1164: * DOCUMENT ME!
1165: */
1166: public static String getCanoncialTimezone(String timezoneStr) {
1167: if (timezoneStr == null) {
1168: return null;
1169: }
1170:
1171: timezoneStr = timezoneStr.trim();
1172:
1173: // Fix windows Daylight/Standard shift JDK doesn't map these (doh)
1174:
1175: int daylightIndex = StringUtils.indexOfIgnoreCase(timezoneStr,
1176: "DAYLIGHT");
1177:
1178: if (daylightIndex != -1) {
1179: StringBuffer timezoneBuf = new StringBuffer();
1180: timezoneBuf.append(timezoneStr.substring(0, daylightIndex));
1181: timezoneBuf.append("Standard");
1182: timezoneBuf.append(timezoneStr.substring(daylightIndex
1183: + "DAYLIGHT".length(), timezoneStr.length()));
1184: timezoneStr = timezoneBuf.toString();
1185: }
1186:
1187: String canonicalTz = (String) TIMEZONE_MAPPINGS
1188: .get(timezoneStr);
1189:
1190: // if we didn't find it, try abbreviated timezones
1191: if (canonicalTz == null) {
1192: String[] abbreviatedTimezone = (String[]) ABBREVIATED_TIMEZONES
1193: .get(timezoneStr);
1194:
1195: if (abbreviatedTimezone != null) {
1196: // If there's only one mapping use that
1197: if (abbreviatedTimezone.length == 1) {
1198: canonicalTz = abbreviatedTimezone[0];
1199: } else {
1200: StringBuffer errorMsg = new StringBuffer(
1201: "The server timezone value '");
1202: errorMsg.append(timezoneStr);
1203: errorMsg
1204: .append("' represents more than one timezone. You must ");
1205: errorMsg
1206: .append("configure either the server or client to use a ");
1207: errorMsg
1208: .append("more specifc timezone value if you want to enable ");
1209: errorMsg
1210: .append("timezone support. The timezones that '");
1211: errorMsg.append(timezoneStr);
1212: errorMsg.append("' maps to are: ");
1213: errorMsg.append(abbreviatedTimezone[0]);
1214:
1215: for (int i = 1; i < abbreviatedTimezone.length; i++) {
1216: errorMsg.append(", ");
1217: errorMsg.append(abbreviatedTimezone[i]);
1218: }
1219:
1220: throw new IllegalArgumentException(errorMsg
1221: .toString());
1222: }
1223: }
1224: }
1225:
1226: return canonicalTz;
1227: }
1228:
1229: // we could use SimpleDateFormat, but it won't work when the time values
1230: // are out-of-bounds, and we're using this for error messages for exactly
1231: // that case
1232: //
1233:
1234: private static String timeFormattedString(int hours, int minutes,
1235: int seconds) {
1236: StringBuffer buf = new StringBuffer(8);
1237: if (hours < 10) {
1238: buf.append("0");
1239: }
1240:
1241: buf.append(hours);
1242: buf.append(":");
1243:
1244: if (minutes < 10) {
1245: buf.append("0");
1246: }
1247:
1248: buf.append(minutes);
1249: buf.append(":");
1250:
1251: if (seconds < 10) {
1252: buf.append("0");
1253: }
1254:
1255: buf.append(seconds);
1256:
1257: return buf.toString();
1258: }
1259: }
|