TimeUtil.java
上传用户:sxlinghang
上传日期:2022-07-20
资源大小:1405k
文件大小:54k
源码类别:

数据库编程

开发平台:

Java

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