Back to index

d-push  2.0
timezoneutil.php
Go to the documentation of this file.
00001 <?php
00002 /***********************************************
00003 * File      :   timezoneutil.php
00004 * Project   :   Z-Push
00005 * Descr     :   class to generate AS compatible timezone information
00006 *
00007 * Created   :   01.06.2012
00008 *
00009 * Copyright 2007 - 2012 Zarafa Deutschland GmbH
00010 *
00011 * This program is free software: you can redistribute it and/or modify
00012 * it under the terms of the GNU Affero General Public License, version 3,
00013 * as published by the Free Software Foundation with the following additional
00014 * term according to sec. 7:
00015 *
00016 * According to sec. 7 of the GNU Affero General Public License, version 3,
00017 * the terms of the AGPL are supplemented with the following terms:
00018 *
00019 * "Zarafa" is a registered trademark of Zarafa B.V.
00020 * "Z-Push" is a registered trademark of Zarafa Deutschland GmbH
00021 * The licensing of the Program under the AGPL does not imply a trademark license.
00022 * Therefore any rights, title and interest in our trademarks remain entirely with us.
00023 *
00024 * However, if you propagate an unmodified version of the Program you are
00025 * allowed to use the term "Z-Push" to indicate that you distribute the Program.
00026 * Furthermore you may use our trademarks where it is necessary to indicate
00027 * the intended purpose of a product or service provided you use it in accordance
00028 * with honest practices in industrial or commercial matters.
00029 * If you want to propagate modified versions of the Program under the name "Z-Push",
00030 * you may only do so if you have a written permission by Zarafa Deutschland GmbH
00031 * (to acquire a permission please contact Zarafa at trademark@zarafa.com).
00032 *
00033 * This program is distributed in the hope that it will be useful,
00034 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00035 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00036 * GNU Affero General Public License for more details.
00037 *
00038 * You should have received a copy of the GNU Affero General Public License
00039 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00040 *
00041 * Consult LICENSE file for details
00042 ************************************************/
00043 
00044 
00045 class TimezoneUtil {
00046 
00055     private static $mstzones = array(
00056                         "000" => array("Dateline Standard Time",                    "(GMT-12:00) International Date Line West"),
00057                         "001" => array("Samoa Standard Time",                       "(GMT-11:00) Midway Island, Samoa"),
00058                         "002" => array("Hawaiian Standard Time",                    "(GMT-10:00) Hawaii"),
00059                         "003" => array("Alaskan Standard Time",                     "(GMT-09:00) Alaska"),
00060                         "004" => array("Pacific Standard Time",                     "(GMT-08:00) Pacific Time (US and Canada); Tijuana"),
00061                         "010" => array("Mountain Standard Time",                    "(GMT-07:00) Mountain Time (US and Canada)"),
00062                         "013" => array("Mexico Standard Time 2",                    "(GMT-07:00) Chihuahua, La Paz, Mazatlan"),
00063                         "015" => array("US Mountain Standard Time",                 "(GMT-07:00) Arizona"),
00064                         "020" => array("Central Standard Time",                     "(GMT-06:00) Central Time (US and Canada"),
00065                         "025" => array("Canada Central Standard Time",              "(GMT-06:00) Saskatchewan"),
00066                         "030" => array("Mexico Standard Time",                      "(GMT-06:00) Guadalajara, Mexico City, Monterrey"),
00067                         "033" => array("Central America Standard Time",             "(GMT-06:00) Central America"),
00068                         "035" => array("Eastern Standard Time",                     "(GMT-05:00) Eastern Time (US and Canada)"),
00069                         "040" => array("US Eastern Standard Time",                  "(GMT-05:00) Indiana (East)"),
00070                         "045" => array("SA Pacific Standard Time",                  "(GMT-05:00) Bogota, Lima, Quito"),
00071                         "uk1" => array("Venezuela Standard Time",                   "(GMT-04:30) Caracas"),                     // added
00072                         "050" => array("Atlantic Standard Time",                    "(GMT-04:00) Atlantic Time (Canada)"),
00073                         "055" => array("SA Western Standard Time",                  "(GMT-04:00) Caracas, La Paz"),
00074                         "056" => array("Pacific SA Standard Time",                  "(GMT-04:00) Santiago"),
00075                         "060" => array("Newfoundland and Labrador Standard Time",   "(GMT-03:30) Newfoundland and Labrador"),
00076                         "065" => array("E South America Standard Time" ,            "(GMT-03:00) Brasilia"),
00077                         "070" => array("SA Eastern Standard Time",                  "(GMT-03:00) Buenos Aires, Georgetown"),
00078                         "073" => array("Greenland Standard Time",                   "(GMT-03:00) Greenland"),
00079                         "075" => array("Mid-Atlantic Standard Time",                "(GMT-02:00) Mid-Atlantic"),
00080                         "080" => array("Azores Standard Time",                      "(GMT-01:00) Azores"),
00081                         "083" => array("Cape Verde Standard Time",                  "(GMT-01:00) Cape Verde Islands"),
00082                         "085" => array("GMT Standard Time",                         "(GMT) Greenwich Mean Time: Dublin, Edinburgh, Lisbon, London"),
00083                         "090" => array("Greenwich Standard Time",                   "(GMT) Casablanca, Monrovia"),
00084                         "095" => array("Central Europe Standard Time",              "(GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague"),
00085                         "100" => array("Central European Standard Time",            "(GMT+01:00) Sarajevo, Skopje, Warsaw, Zagreb"),
00086                         "105" => array("Romance Standard Time",                     "(GMT+01:00) Brussels, Copenhagen, Madrid, Paris"),
00087                         "110" => array("W Europe Standard Time",                    "(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna"),
00088                         "113" => array("W Central Africa Standard Time",            "(GMT+01:00) West Central Africa"),
00089                         "115" => array("E Europe Standard Time",                    "(GMT+02:00) Bucharest"),
00090                         "120" => array("Egypt Standard Time",                       "(GMT+02:00) Cairo"),
00091                         "125" => array("FLE Standard Time",                         "(GMT+02:00) Helsinki, Kiev, Riga, Sofia, Tallinn, Vilnius"),
00092                         "130" => array("GTB Standard Time",                         "(GMT+02:00) Athens, Istanbul, Minsk"),
00093                         "135" => array("Israel Standard Time",                      "(GMT+02:00) Jerusalem"),
00094                         "140" => array("South Africa Standard Time",                "(GMT+02:00) Harare, Pretoria"),
00095                         "145" => array("Russian Standard Time",                     "(GMT+03:00) Moscow, St. Petersburg, Volgograd"),
00096                         "150" => array("Arab Standard Time",                        "(GMT+03:00) Kuwait, Riyadh"),
00097                         "155" => array("E Africa Standard Time",                    "(GMT+03:00) Nairobi"),
00098                         "158" => array("Arabic Standard Time",                      "(GMT+03:00) Baghdad"),
00099                         "160" => array("Iran Standard Time",                        "(GMT+03:30) Tehran"),
00100                         "165" => array("Arabian Standard Time",                     "(GMT+04:00) Abu Dhabi, Muscat"),
00101                         "170" => array("Caucasus Standard Time",                    "(GMT+04:00) Baku, Tbilisi, Yerevan"),
00102                         "175" => array("Transitional Islamic State of Afghanistan Standard Time","(GMT+04:30) Kabul"),
00103                         "180" => array("Ekaterinburg Standard Time",                "(GMT+05:00) Ekaterinburg"),
00104                         "185" => array("West Asia Standard Time",                   "(GMT+05:00) Islamabad, Karachi, Tashkent"),
00105                         "190" => array("India Standard Time",                       "(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi"),
00106                         "193" => array("Nepal Standard Time",                       "(GMT+05:45) Kathmandu"),
00107                         "195" => array("Central Asia Standard Time",                "(GMT+06:00) Astana, Dhaka"),
00108                         "200" => array("Sri Lanka Standard Time",                   "(GMT+06:00) Sri Jayawardenepura"),
00109                         "201" => array("N Central Asia Standard Time",              "(GMT+06:00) Almaty, Novosibirsk"),
00110                         "203" => array("Myanmar Standard Time",                     "(GMT+06:30) Yangon Rangoon"),
00111                         "205" => array("SE Asia Standard Time",                     "(GMT+07:00) Bangkok, Hanoi, Jakarta"),
00112                         "207" => array("North Asia Standard Time",                  "(GMT+07:00) Krasnoyarsk"),
00113                         "210" => array("China Standard Time",                       "(GMT+08:00) Beijing, Chongqing, Hong Kong SAR, Urumqi"),
00114                         "215" => array("Singapore Standard Time",                   "(GMT+08:00) Kuala Lumpur, Singapore"),
00115                         "220" => array("Taipei Standard Time",                      "(GMT+08:00) Taipei"),
00116                         "225" => array("W Australia Standard Time",                 "(GMT+08:00) Perth"),
00117                         "227" => array("North Asia East Standard Time",             "(GMT+08:00) Irkutsk, Ulaanbaatar"),
00118                         "230" => array("Korea Standard Time",                       "(GMT+09:00) Seoul"),
00119                         "235" => array("Tokyo Standard Time",                       "(GMT+09:00) Osaka, Sapporo, Tokyo"),
00120                         "240" => array("Yakutsk Standard Time",                     "(GMT+09:00) Yakutsk"),
00121                         "245" => array("AUS Central Standard Time",                 "(GMT+09:30) Darwin"),
00122                         "250" => array("Cen Australia Standard Time",               "(GMT+09:30) Adelaide"),
00123                         "255" => array("AUS Eastern Standard Time",                 "(GMT+10:00) Canberra, Melbourne, Sydney"),
00124                         "260" => array("E Australia Standard Time",                 "(GMT+10:00) Brisbane"),
00125                         "265" => array("Tasmania Standard Time",                    "(GMT+10:00) Hobart"),
00126                         "270" => array("Vladivostok Standard Time",                 "(GMT+10:00) Vladivostok"),
00127                         "275" => array("West Pacific Standard Time",                "(GMT+10:00) Guam, Port Moresby"),
00128                         "280" => array("Central Pacific Standard Time",             "(GMT+11:00) Magadan, Solomon Islands, New Caledonia"),
00129                         "285" => array("Fiji Islands Standard Time",                "(GMT+12:00) Fiji Islands, Kamchatka, Marshall Islands"),
00130                         "290" => array("New Zealand Standard Time",                 "(GMT+12:00) Auckland, Wellington"),
00131                         "300" => array("Tonga Standard Time",                       "(GMT+13:00) Nuku'alofa"),
00132                 );
00133 
00164     private static $tzonesoffsets = array(
00165                         "Transitional Islamic State of Afghanistan Standard Time"
00166                                                                     => array(-270, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00167                         "Alaskan Standard Time"                     => array(540, 0, -60,  0, 11, 0, 1, 2, 0, 0, 0,  0, 3, 0, 2, 2, 0, 0, 0),
00168                         "Arab Standard Time"                        => array(-180, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00169                         "Arabian Standard Time"                     => array(-240, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00170                         "Arabic Standard Time"                      => array(-180, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00171                         //"Argentina Standard Time"                   => array(180, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00172                         "Atlantic Standard Time"                    => array(240, 0, -60,  0, 11, 0, 1, 2, 0, 0, 0,  0, 3, 0, 2, 2, 0, 0, 0),
00173                         "AUS Central Standard Time"                 => array(-570, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00174                         "AUS Eastern Standard Time"                 => array(-600, 0, -60,  0, 4, 0, 1, 3, 0, 0, 0,  0, 10, 0, 1, 2, 0, 0, 0),
00175                         //"Azerbaijan Standard Time"                  => array(-240, 0, -60,  0, 10, 0, 5, 5, 0, 0, 0,  0, 3, 0, 5, 4, 0, 0, 0),
00176                         "Azores Standard Time"                      => array(60, 0, -60,  0, 10, 0, 5, 3, 0, 0, 0,  0, 3, 0, 5, 2, 0, 0, 0),
00177                         //"Bangladesh Standard Time"                  => array(-360, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00178                         "Canada Central Standard Time"              => array(360, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00179                         "Cape Verde Standard Time"                  => array(60, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00180                         "Caucasus Standard Time"                    => array(-240, 0, -60,  0, 10, 0, 5, 3, 0, 0, 0,  0, 3, 0, 5, 2, 0, 0, 0),
00181                         "Cen Australia Standard Time"               => array(-570, 0, -60,  0, 4, 0, 1, 3, 0, 0, 0,  0, 10, 0, 1, 2, 0, 0, 0),
00182                         "Central America Standard Time"             => array(360, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00183                         "Central Asia Standard Time"                => array(-360, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00184                         //"Central Brazilian Standard Time"           => array(240, 0, -60,  0, 2, 6, 4, 23, 59, 59, 999,  0, 10, 6, 3, 23, 59, 59, 999),
00185                         "Central Europe Standard Time"              => array(-60, 0, -60,  0, 10, 0, 5, 3, 0, 0, 0,  0, 3, 0, 5, 2, 0, 0, 0),
00186                         "Central European Standard Time"            => array(-60, 0, -60,  0, 10, 0, 5, 3, 0, 0, 0,  0, 3, 0, 5, 2, 0, 0, 0),
00187                         "Central Pacific Standard Time"             => array(-660, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00188                         "Central Standard Time"                     => array(360, 0, -60,  0, 11, 0, 1, 2, 0, 0, 0,  0, 3, 0, 2, 2, 0, 0, 0),
00189                         "Mexico Standard Time"                      => array(360, 0, -60,  0, 10, 0, 5, 2, 0, 0, 0,  0, 4, 0, 1, 2, 0, 0, 0),
00190                         "China Standard Time"                       => array(-480, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00191                         "Dateline Standard Time"                    => array(720, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00192                         "E Africa Standard Time"                    => array(-180, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00193                         "E Australia Standard Time"                 => array(-600, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00194                         "E Europe Standard Time"                    => array(-120, 0, -60,  0, 10, 0, 5, 3, 0, 0, 0,  0, 3, 0, 5, 2, 0, 0, 0),
00195                         "E South America Standard Time"             => array(180, 0, -60,  0, 2, 6, 4, 23, 59, 59, 999,  0, 10, 6, 3, 23, 59, 59, 999),
00196                         "Eastern Standard Time"                     => array(300, 0, -60,  0, 11, 0, 1, 2, 0, 0, 0,  0, 3, 0, 2, 2, 0, 0, 0),
00197                         "Egypt Standard Time"                       => array(-120, 0, -60,  0, 9, 4, 5, 23, 59, 59, 999,  0, 4, 4, 5, 23, 59, 59, 999),
00198                         "Ekaterinburg Standard Time"                => array(-300, 0, -60,  0, 10, 0, 5, 3, 0, 0, 0,  0, 3, 0, 5, 2, 0, 0, 0),
00199                         "Fiji Islands Standard Time"                => array(-720, 0, -60,  0, 3, 0, 5, 3, 0, 0, 0,  0, 10, 0, 4, 2, 0, 0, 0),
00200                         "FLE Standard Time"                         => array(-120, 0, -60,  0, 10, 0, 5, 4, 0, 0, 0,  0, 3, 0, 5, 3, 0, 0, 0),
00201                         //"Georgian Standard Time"                    => array(-240, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00202                         "GMT Standard Time"                         => array(0, 0, -60,  0, 10, 0, 5, 2, 0, 0, 0,  0, 3, 0, 5, 1, 0, 0, 0),
00203                         "Greenland Standard Time"                   => array(180, 0, -60,  0, 10, 6, 5, 23, 0, 0, 0,  0, 3, 6, 4, 22, 0, 0, 0),
00204                         "Greenwich Standard Time"                   => array(0, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00205                         "GTB Standard Time"                         => array(-120, 0, -60,  0, 10, 0, 5, 4, 0, 0, 0,  0, 3, 0, 5, 3, 0, 0, 0),
00206                         "Hawaiian Standard Time"                    => array(600, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00207                         "India Standard Time"                       => array(-330, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00208                         "Iran Standard Time"                        => array(-210, 0, -60,  0, 9, 1, 3, 23, 59, 59, 999,  0, 3, 6, 3, 23, 59, 59, 999),
00209                         "Israel Standard Time"                      => array(-120, 0, -60,  0, 9, 0, 4, 2, 0, 0, 0,  0, 3, 5, 5, 2, 0, 0, 0),
00210                         //"Jordan Standard Time"                      => array(-120, 0, -60,  0, 10, 5, 5, 1, 0, 0, 0,  0, 3, 4, 5, 23, 59, 59, 999),
00211                         //"Kamchatka Standard Time"                   => array(-720, 0, -60,  0, 10, 0, 5, 3, 0, 0, 0,  0, 3, 0, 5, 2, 0, 0, 0),
00212                         "Korea Standard Time"                       => array(-540, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00213                         //"Magadan Standard Time"                     => array(-660, 0, -60,  0, 10, 0, 5, 3, 0, 0, 0,  0, 3, 0, 5, 2, 0, 0, 0),
00214                         //"Mauritius Standard Time"                   => array(-240, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00215                         "Mid-Atlantic Standard Time"                => array(120, 0, -60,  0, 9, 0, 5, 2, 0, 0, 0,  0, 3, 0, 5, 2, 0, 0, 0),
00216                         //"Middle East Standard Time"                 => array(-120, 0, -60,  0, 10, 6, 5, 23, 59, 59, 999,  0, 3, 6, 4, 23, 59, 59, 999),
00217                         //"Montevideo Standard Time"                  => array(180, 0, -60,  0, 3, 0, 2, 2, 0, 0, 0,  0, 10, 0, 1, 2, 0, 0, 0),
00218                         //"Morocco Standard Time"                     => array(0, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00219                         "Mountain Standard Time"                    => array(420, 0, -60,  0, 11, 0, 1, 2, 0, 0, 0,  0, 3, 0, 2, 2, 0, 0, 0),
00220                         "Mexico Standard Time 2"                    => array(420, 0, -60,  0, 10, 0, 5, 2, 0, 0, 0,  0, 4, 0, 1, 2, 0, 0, 0),
00221                         "Myanmar Standard Time"                     => array(-390, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00222                         "N Central Asia Standard Time"              => array(-360, 0, -60,  0, 10, 0, 5, 3, 0, 0, 0,  0, 3, 0, 5, 2, 0, 0, 0),
00223                         //"Namibia Standard Time"                     => array(-60, 0, -60,  0, 4, 0, 1, 2, 0, 0, 0,  0, 9, 0, 1, 2, 0, 0, 0),
00224                         "Nepal Standard Time"                       => array(-345, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00225                         "New Zealand Standard Time"                 => array(-720, 0, -60,  0, 4, 0, 1, 3, 0, 0, 0,  0, 9, 0, 5, 2, 0, 0, 0),
00226                         "Newfoundland and Labrador Standard Time"   => array(210, 0, -60,  0, 11, 0, 1, 0, 1, 0, 0,  0, 3, 0, 2, 0, 1, 0, 0),
00227                         "North Asia East Standard Time"             => array(-480, 0, -60,  0, 10, 0, 5, 3, 0, 0, 0,  0, 3, 0, 5, 2, 0, 0, 0),
00228                         "North Asia Standard Time"                  => array(-420, 0, -60,  0, 10, 0, 5, 3, 0, 0, 0,  0, 3, 0, 5, 2, 0, 0, 0),
00229                         "Pacific SA Standard Time"                  => array(240, 0, -60,  0, 3, 6, 2, 23, 59, 59, 999,  0, 10, 6, 2, 23, 59, 59, 999),
00230                         "Pacific Standard Time"                     => array(480, 0, -60,  0, 11, 0, 1, 2, 0, 0, 0,  0, 3, 0, 2, 2, 0, 0, 0),
00231                         //"Pacific Standard Time (Mexico)"            => array(480, 0, -60,  0, 10, 0, 5, 2, 0, 0, 0,  0, 4, 0, 1, 2, 0, 0, 0),
00232                         //"Pakistan Standard Time"                    => array(-300, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00233                         //"Paraguay Standard Time"                    => array(240, 0, -60,  0, 4, 6, 1, 23, 59, 59, 999,  0, 10, 6, 1, 23, 59, 59, 999),
00234                         "Romance Standard Time"                     => array(-60, 0, -60,  0, 10, 0, 5, 3, 0, 0, 0,  0, 3, 0, 5, 2, 0, 0, 0),
00235                         "Russian Standard Time"                     => array(-180, 0, -60,  0, 10, 0, 5, 3, 0, 0, 0,  0, 3, 0, 5, 2, 0, 0, 0),
00236                         "SA Eastern Standard Time"                  => array(180, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00237                         "SA Pacific Standard Time"                  => array(300, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00238                         "SA Western Standard Time"                  => array(240, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00239                         "Samoa Standard Time"                       => array(660, 0, -60,  0, 3, 6, 5, 23, 59, 59, 999,  0, 9, 6, 5, 23, 59, 59, 999),
00240                         "SE Asia Standard Time"                     => array(-420, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00241                         "Singapore Standard Time"                   => array(-480, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00242                         "South Africa Standard Time"                => array(-120, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00243                         "Sri Lanka Standard Time"                   => array(-330, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00244                         //"Syria Standard Time"                       => array(-120, 0, -60,  0, 10, 4, 5, 23, 59, 59, 999,  0, 4, 4, 1, 23, 59, 59, 999),
00245                         "Taipei Standard Time"                      => array(-480, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00246                         "Tasmania Standard Time"                    => array(-600, 0, -60,  0, 4, 0, 1, 3, 0, 0, 0,  0, 10, 0, 1, 2, 0, 0, 0),
00247                         "Tokyo Standard Time"                       => array(-540, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00248                         "Tonga Standard Time"                       => array(-780, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00249                         //"Ulaanbaatar Standard Time"                 => array(-480, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00250                         "US Eastern Standard Time"                  => array(300, 0, -60,  0, 11, 0, 1, 2, 0, 0, 0,  0, 3, 0, 2, 2, 0, 0, 0),
00251                         "US Mountain Standard Time"                 => array(420, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00252                         //"UTC"                                       => array(0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00253                         //"UTC+12"                                    => array(-720, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00254                         //"UTC-02"                                    => array(120, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00255                         //"UTC-11"                                    => array(660, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00256                         "Venezuela Standard Time"                   => array(270, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00257                         "Vladivostok Standard Time"                 => array(-600, 0, -60,  0, 10, 0, 5, 3, 0, 0, 0,  0, 3, 0, 5, 2, 0, 0, 0),
00258                         "W Australia Standard Time"                 => array(-480, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00259                         "W Central Africa Standard Time"            => array(-60, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00260                         "W Europe Standard Time"                    => array(-60, 0, -60,  0, 10, 0, 5, 3, 0, 0, 0,  0, 3, 0, 5, 2, 0, 0, 0),
00261                         "West Asia Standard Time"                   => array(-300, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00262                         "West Pacific Standard Time"                => array(-600, 0, -60,  0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0),
00263                         "Yakutsk Standard Time"                     => array(-540, 0, -60,  0, 10, 0, 5, 3, 0, 0, 0,  0, 3, 0, 5, 2, 0, 0, 0),
00264                 );
00265 
00271     private static $phptimezones = array(
00272             // -720 min
00273             "Dateline Standard Time" => array(
00274                         "Etc/GMT+12",
00275                  ),
00276 
00277             // -660 min
00278             "Samoa Standard Time" => array(
00279                         "Etc/GMT+11",
00280                         "Pacific/Midway",
00281                         "Pacific/Niue",
00282                         "Pacific/Pago_Pago",
00283                         "Pacific/Samoa",
00284                         "US/Samoa",
00285                  ),
00286 
00287             // -600 min
00288             "Hawaiian Standard Time" => array(
00289                         "America/Adak",
00290                         "America/Atka",
00291                         "Etc/GMT+10",
00292                         "HST",
00293                         "Pacific/Honolulu",
00294                         "Pacific/Johnston",
00295                         "Pacific/Rarotonga",
00296                         "Pacific/Tahiti",
00297                         "US/Aleutian",
00298                         "US/Hawaii",
00299                  ),
00300 
00301             // -570 min
00302             "-570" => array(
00303                         "Pacific/Marquesas",
00304                  ),
00305 
00306             // -540 min
00307             "Alaskan Standard Time" => array(
00308                         "America/Anchorage",
00309                         "America/Juneau",
00310                         "America/Nome",
00311                         "America/Sitka",
00312                         "America/Yakutat",
00313                         "Etc/GMT+9",
00314                         "Pacific/Gambier",
00315                         "US/Alaska",
00316                  ),
00317 
00318             // -480 min
00319             "Pacific Standard Time" => array(
00320                         "America/Dawson",
00321                         "America/Ensenada",
00322                         "America/Los_Angeles",
00323                         "America/Metlakatla",
00324                         "America/Santa_Isabel",
00325                         "America/Tijuana",
00326                         "America/Vancouver",
00327                         "America/Whitehorse",
00328                         "Canada/Pacific",
00329                         "Canada/Yukon",
00330                         "Etc/GMT+8",
00331                         "Mexico/BajaNorte",
00332                         "Pacific/Pitcairn",
00333                         "PST8PDT",
00334                         "US/Pacific",
00335                         "US/Pacific-New",
00336                  ),
00337 
00338             // -420 min
00339             "US Mountain Standard Time" => array(
00340                         "America/Boise",
00341                         "America/Cambridge_Bay",
00342                         "America/Chihuahua",
00343                         "America/Creston",
00344                         "America/Dawson_Creek",
00345                         "America/Denver",
00346                         "America/Edmonton",
00347                         "America/Hermosillo",
00348                         "America/Inuvik",
00349                         "America/Mazatlan",
00350                         "America/Ojinaga",
00351                         "America/Phoenix",
00352                         "America/Shiprock",
00353                         "America/Yellowknife",
00354                         "Canada/Mountain",
00355                         "Etc/GMT+7",
00356                         "Mexico/BajaSur",
00357                         "MST",
00358                         "MST7MDT",
00359                         "Navajo",
00360                         "US/Arizona",
00361                         "US/Mountain",
00362                  ),
00363 
00364             // -360 min
00365             "Central Standard Time" => array(
00366                         "America/Chicago",
00367                         "America/Indiana/Knox",
00368                         "America/Indiana/Tell_City",
00369                         "America/Knox_IN",
00370                         "America/North_Dakota/Beulah",
00371                         "America/North_Dakota/Center",
00372                         "America/North_Dakota/New_Salem",
00373                         "America/Rainy_River",
00374                         "America/Rankin_Inlet",
00375                         "America/Regina",
00376                         "America/Resolute",
00377                         "America/Swift_Current",
00378                         "America/Tegucigalpa",
00379                         "America/Winnipeg",
00380                         "US/Central",
00381                         "US/Indiana-Starke",
00382                         "CST6CDT",
00383                         "Etc/GMT+6",
00384                  ),
00385             "Canada Central Standard Time" => array(
00386                         "Canada/Central",
00387                         "Canada/East-Saskatchewan",
00388                         "Canada/Saskatchewan",
00389                  ),
00390             "Mexico Standard Time" => array(
00391                         "America/Mexico_City",
00392                         "America/Monterrey",
00393                         "Mexico/General",
00394                  ),
00395             "Central America Standard Time" => array(
00396                         "America/Bahia_Banderas",
00397                         "America/Belize",
00398                         "America/Cancun",
00399                         "America/Costa_Rica",
00400                         "America/El_Salvador",
00401                         "America/Guatemala",
00402                         "America/Managua",
00403                         "America/Matamoros",
00404                         "America/Menominee",
00405                         "America/Merida",
00406                         "Chile/EasterIsland",
00407                         "Pacific/Easter",
00408                         "Pacific/Galapagos",
00409                  ),
00410 
00411             // -300 min
00412             "US Eastern Standard Time" => array(
00413                         "America/Detroit",
00414                         "America/Fort_Wayne",
00415                         "America/Grand_Turk",
00416                         "America/Indiana/Indianapolis",
00417                         "America/Indiana/Marengo",
00418                         "America/Indiana/Petersburg",
00419                         "America/Indiana/Vevay",
00420                         "America/Indiana/Vincennes",
00421                         "America/Indiana/Winamac",
00422                         "America/Indianapolis",
00423                         "America/Jamaica",
00424                         "America/Kentucky/Louisville",
00425                         "America/Kentucky/Monticello",
00426                         "America/Louisville",
00427                         "America/Montreal",
00428                         "America/New_York",
00429                         "America/Thunder_Bay",
00430                         "America/Toronto",
00431                         "Canada/Eastern",
00432                         "Cuba",
00433                         "EST",
00434                         "EST5EDT",
00435                         "Etc/GMT+5",
00436                         "Jamaica",
00437                         "US/East-Indiana",
00438                         "US/Eastern",
00439                         "US/Michigan",
00440                  ),
00441             "SA Pacific Standard Time" => array(
00442                         "America/Atikokan",
00443                         "America/Bogota",
00444                         "America/Cayman",
00445                         "America/Coral_Harbour",
00446                         "America/Guayaquil",
00447                         "America/Havana",
00448                         "America/Iqaluit",
00449                         "America/Lima",
00450                         "America/Nassau",
00451                         "America/Nipigon",
00452                         "America/Panama",
00453                         "America/Pangnirtung",
00454                         "America/Port-au-Prince",
00455                  ),
00456 
00457             // -270 min
00458             "Venezuela Standard Time" => array(
00459                         "America/Caracas",
00460                  ),
00461             // -240 min
00462             "Atlantic Standard Time" => array(
00463                         "America/Barbados",
00464                         "America/Blanc-Sablon",
00465                         "America/Glace_Bay",
00466                         "America/Goose_Bay",
00467                         "America/Halifax",
00468                         "America/Lower_Princes",
00469                         "America/St_Barthelemy",
00470                         "America/St_Kitts",
00471                         "America/St_Lucia",
00472                         "America/St_Thomas",
00473                         "America/St_Vincent",
00474                         "America/Thule",
00475                         "America/Tortola",
00476                         "America/Virgin",
00477                         "Atlantic/Bermuda",
00478                         "Canada/Atlantic",
00479                         "Etc/GMT+4",
00480                  ),
00481             "SA Western Standard Time" => array(
00482                         "America/Anguilla",
00483                         "America/Antigua",
00484                         "America/Aruba",
00485                         "America/Asuncion",
00486                         "America/Boa_Vista",
00487                         "America/Campo_Grande",
00488                         "America/Cuiaba",
00489                         "America/Curacao",
00490                         "America/Dominica",
00491                         "America/Eirunepe",
00492                         "America/Grenada",
00493                         "America/Guadeloupe",
00494                         "America/Guyana",
00495                         "America/Kralendijk",
00496                         "America/La_Paz",
00497                         "America/Manaus",
00498                         "America/Marigot",
00499                         "America/Martinique",
00500                         "America/Moncton",
00501                         "America/Montserrat",
00502                         "America/Port_of_Spain",
00503                         "America/Porto_Acre",
00504                         "America/Porto_Velho",
00505                         "America/Puerto_Rico",
00506                         "America/Rio_Branco",
00507                         "Brazil/Acre",
00508                         "Brazil/West",
00509                  ),
00510             "Pacific SA Standard Time" => array(
00511                         "America/Santiago",
00512                         "America/Santo_Domingo",
00513                         "Antarctica/Palmer",
00514                         "Chile/Continental",
00515                  ),
00516 
00517             // -210 min
00518             "Newfoundland and Labrador Standard Time" => array(
00519                         "America/St_Johns",
00520                         "Canada/Newfoundland",
00521                  ),
00522 
00523             // -180 min
00524             "E South America Standard Time" => array(
00525                         "America/Araguaina",
00526                         "America/Bahia",
00527                         "America/Belem",
00528                         "America/Fortaleza",
00529                         "America/Maceio",
00530                         "America/Recife",
00531                         "America/Sao_Paulo",
00532                         "Brazil/East",
00533                         "Etc/GMT+3",
00534                  ),
00535             "SA Eastern Standard Time" => array(
00536                         "America/Argentina/Buenos_Aires",
00537                         "America/Argentina/Catamarca",
00538                         "America/Argentina/ComodRivadavia",
00539                         "America/Argentina/Cordoba",
00540                         "America/Argentina/Jujuy",
00541                         "America/Argentina/La_Rioja",
00542                         "America/Argentina/Mendoza",
00543                         "America/Argentina/Rio_Gallegos",
00544                         "America/Argentina/Salta",
00545                         "America/Argentina/San_Juan",
00546                         "America/Argentina/San_Luis",
00547                         "America/Argentina/Tucuman",
00548                         "America/Argentina/Ushuaia",
00549                         "America/Buenos_Aires",
00550                         "America/Catamarca",
00551                         "America/Cayenne",
00552                         "America/Cordoba",
00553                         "America/Godthab",
00554                         "America/Jujuy",
00555                         "America/Mendoza",
00556                         "America/Miquelon",
00557                         "America/Montevideo",
00558                         "America/Paramaribo",
00559                         "America/Rosario",
00560                         "America/Santarem",
00561                  ),
00562             "Greenland Standard Time" => array(
00563                         "Antarctica/Rothera",
00564                         "Atlantic/Stanley",
00565                  ),
00566 
00567             // -120 min
00568             "Mid-Atlantic Standard Time" => array(
00569                         "America/Noronha",
00570                         "Atlantic/South_Georgia",
00571                         "Brazil/DeNoronha",
00572                         "Etc/GMT+2",
00573                  ),
00574 
00575             // -60 min
00576             "Azores Standard Time" => array(
00577                         "Atlantic/Azores",
00578                         "Etc/GMT+1",
00579                  ),
00580             "Cape Verde Standard Time" => array(
00581                         "America/Scoresbysund",
00582                         "Atlantic/Cape_Verde",
00583                  ),
00584 
00585             // 0 min
00586             "GMT Standard Time" => array(
00587                         "Eire",
00588                         "Etc/GMT",
00589                         "Etc/GMT+0",
00590                         "Etc/GMT-0",
00591                         "Etc/GMT0",
00592                         "Etc/Greenwich",
00593                         "Etc/UCT",
00594                         "Etc/Universal",
00595                         "Etc/UTC",
00596                         "Etc/Zulu",
00597                         "Europe/Belfast",
00598                         "Europe/Dublin",
00599                         "Europe/Guernsey",
00600                         "Europe/Isle_of_Man",
00601                         "Europe/Jersey",
00602                         "Europe/Lisbon",
00603                         "Europe/London",
00604                         "Factory",
00605                         "GB",
00606                         "GB-Eire",
00607                         "GMT",
00608                         "GMT+0",
00609                         "GMT-0",
00610                         "GMT0",
00611                         "Greenwich",
00612                         "Iceland",
00613                         "Portugal",
00614                         "UCT",
00615                         "Universal",
00616                         "UTC",
00617                  ),
00618             "Greenwich Standard Time" => array(
00619                         "Africa/Abidjan",
00620                         "Africa/Accra",
00621                         "Africa/Bamako",
00622                         "Africa/Banjul",
00623                         "Africa/Bissau",
00624                         "Africa/Casablanca",
00625                         "Africa/Conakry",
00626                         "Africa/Dakar",
00627                         "Africa/El_Aaiun",
00628                         "Africa/Freetown",
00629                         "Africa/Lome",
00630                         "Africa/Monrovia",
00631                         "Africa/Nouakchott",
00632                         "Africa/Ouagadougou",
00633                         "Africa/Sao_Tome",
00634                         "Africa/Timbuktu",
00635                         "America/Danmarkshavn",
00636                         "Atlantic/Canary",
00637                         "Atlantic/Faeroe",
00638                         "Atlantic/Faroe",
00639                         "Atlantic/Madeira",
00640                         "Atlantic/Reykjavik",
00641                         "Atlantic/St_Helena",
00642                         "Zulu",
00643                  ),
00644 
00645             // +60 min
00646             "Central Europe Standard Time" => array(
00647                         "Europe/Belgrade",
00648                         "Europe/Bratislava",
00649                         "Europe/Budapest",
00650                         "Europe/Ljubljana",
00651                         "Europe/Prague",
00652                         "Europe/Vaduz",
00653                  ),
00654             "Central European Standard Time" => array(
00655                         "Europe/Sarajevo",
00656                         "Europe/Skopje",
00657                         "Europe/Warsaw",
00658                         "Europe/Zagreb",
00659                         "MET",
00660                         "Poland",
00661                  ),
00662             "Romance Standard Time" => array(
00663                         "Europe/Andorra",
00664                         "Europe/Brussels",
00665                         "Europe/Copenhagen",
00666                         "Europe/Gibraltar",
00667                         "Europe/Madrid",
00668                         "Europe/Malta",
00669                         "Europe/Monaco",
00670                         "Europe/Paris",
00671                         "Europe/Podgorica",
00672                         "Europe/San_Marino",
00673                         "Europe/Tirane",
00674                  ),
00675             "W Europe Standard Time" => array(
00676                         "Europe/Amsterdam",
00677                         "Europe/Berlin",
00678                         "Europe/Luxembourg",
00679                         "Europe/Vatican",
00680                         "Europe/Rome",
00681                         "Europe/Stockholm",
00682                         "Arctic/Longyearbyen",
00683                         "Europe/Vienna",
00684                         "Europe/Zurich",
00685                         "Europe/Oslo",
00686                         "WET",
00687                         "CET",
00688                         "Etc/GMT-1",
00689                  ),
00690             "W Central Africa Standard Time" => array(
00691                         "Africa/Algiers",
00692                         "Africa/Bangui",
00693                         "Africa/Brazzaville",
00694                         "Africa/Ceuta",
00695                         "Africa/Douala",
00696                         "Africa/Kinshasa",
00697                         "Africa/Lagos",
00698                         "Africa/Libreville",
00699                         "Africa/Luanda",
00700                         "Africa/Malabo",
00701                         "Africa/Ndjamena",
00702                         "Africa/Niamey",
00703                         "Africa/Porto-Novo",
00704                         "Africa/Tunis",
00705                         "Africa/Windhoek",
00706                         "Atlantic/Jan_Mayen",
00707                  ),
00708 
00709             // +120 min
00710             "E Europe Standard Time" => array(
00711                         "Europe/Bucharest",
00712                         "EET",
00713                         "Etc/GMT-2",
00714                         "Europe/Chisinau",
00715                         "Europe/Mariehamn",
00716                         "Europe/Nicosia",
00717                         "Europe/Simferopol",
00718                         "Europe/Tiraspol",
00719                         "Europe/Uzhgorod",
00720                         "Europe/Zaporozhye",
00721                  ),
00722             "Egypt Standard Time" => array(
00723                         "Africa/Cairo",
00724                         "Africa/Tripoli",
00725                         "Egypt",
00726                         "Libya",
00727                  ),
00728             "FLE Standard Time" => array(
00729                         "Europe/Helsinki",
00730                         "Europe/Kiev",
00731                         "Europe/Riga",
00732                         "Europe/Sofia",
00733                         "Europe/Tallinn",
00734                         "Europe/Vilnius",
00735                  ),
00736             "GTB Standard Time" => array(
00737                         "Asia/Istanbul",
00738                         "Europe/Athens",
00739                         "Europe/Istanbul",
00740                         "Turkey",
00741                  ),
00742             "Israel Standard Time" => array(
00743                         "Asia/Amman",
00744                         "Asia/Beirut",
00745                         "Asia/Damascus",
00746                         "Asia/Gaza",
00747                         "Asia/Hebron",
00748                         "Asia/Nicosia",
00749                         "Asia/Tel_Aviv",
00750                         "Asia/Jerusalem",
00751                         "Israel",
00752                  ),
00753             "South Africa Standard Time" => array(
00754                         "Africa/Blantyre",
00755                         "Africa/Bujumbura",
00756                         "Africa/Gaborone",
00757                         "Africa/Harare",
00758                         "Africa/Johannesburg",
00759                         "Africa/Kigali",
00760                         "Africa/Lubumbashi",
00761                         "Africa/Lusaka",
00762                         "Africa/Maputo",
00763                         "Africa/Maseru",
00764                         "Africa/Mbabane",
00765                  ),
00766 
00767             // +180 min
00768             "Russian Standard Time" => array(
00769                         "Antarctica/Syowa",
00770                         "Europe/Kaliningrad",
00771                         "Europe/Minsk",
00772                         "Etc/GMT-3",
00773                  ),
00774             "Arab Standard Time" => array(
00775                         "Asia/Qatar",
00776                         "Asia/Kuwait",
00777                         "Asia/Riyadh",
00778                  ),
00779             "E Africa Standard Time" => array(
00780                         "Africa/Addis_Ababa",
00781                         "Africa/Asmara",
00782                         "Africa/Asmera",
00783                         "Africa/Dar_es_Salaam",
00784                         "Africa/Djibouti",
00785                         "Africa/Juba",
00786                         "Africa/Kampala",
00787                         "Africa/Khartoum",
00788                         "Africa/Mogadishu",
00789                         "Africa/Nairobi",
00790                  ),
00791             "Arabic Standard Time" => array(
00792                         "Asia/Aden",
00793                         "Asia/Baghdad",
00794                         "Asia/Bahrain",
00795                         "Indian/Antananarivo",
00796                         "Indian/Comoro",
00797                         "Indian/Mayotte",
00798                  ),
00799 
00800             // +210 min
00801             "Iran Standard Time" => array(
00802                         "Asia/Tehran",
00803                         "Iran",
00804                  ),
00805 
00806             // +240 min
00807             "Arabian Standard Time" => array(
00808                         "Asia/Dubai",
00809                         "Asia/Muscat",
00810                         "Indian/Mahe",
00811                         "Indian/Mauritius",
00812                         "Indian/Reunion",
00813                  ),
00814             "Caucasus Standard Time" => array(
00815                         "Asia/Baku",
00816                         "Asia/Tbilisi",
00817                         "Asia/Yerevan",
00818                         "Etc/GMT-4",
00819                         "Europe/Moscow",
00820                         "Europe/Samara",
00821                         "Europe/Volgograd",
00822                         "W-SU",
00823                  ),
00824 
00825             // +270 min
00826             "Transitional Islamic State of Afghanistan Standard Time" => array(
00827                         "Asia/Kabul",
00828                  ),
00829 
00830             // +300 min
00831             "Ekaterinburg Standard Time" => array(
00832                         "Antarctica/Mawson",
00833                  ),
00834             "West Asia Standard Time" => array(
00835                         "Asia/Aqtau",
00836                         "Asia/Aqtobe",
00837                         "Asia/Ashgabat",
00838                         "Asia/Ashkhabad",
00839                         "Asia/Dushanbe",
00840                         "Asia/Karachi",
00841                         "Asia/Oral",
00842                         "Asia/Samarkand",
00843                         "Asia/Tashkent",
00844                         "Etc/GMT-5",
00845                         "Indian/Kerguelen",
00846                         "Indian/Maldives",
00847                  ),
00848 
00849             // +330 min
00850             "India Standard Time" => array(
00851                         "Asia/Calcutta",
00852                         "Asia/Colombo",
00853                         "Asia/Kolkata",
00854                  ),
00855 
00856             // +345 min
00857             "Nepal Standard Time" => array(
00858                         "Asia/Kathmandu",
00859                         "Asia/Katmandu",
00860                  ),
00861 
00862             // +360 min
00863             "Central Asia Standard Time" => array(
00864                         "Asia/Dacca",
00865                         "Asia/Dhaka",
00866                  ),
00867             "Sri Lanka Standard Time" => array(
00868                         "Indian/Chagos",
00869                  ),
00870             "N Central Asia Standard Time" => array(
00871                         "Antarctica/Vostok",
00872                         "Asia/Almaty",
00873                         "Asia/Bishkek",
00874                         "Asia/Qyzylorda",
00875                         "Asia/Thimbu",
00876                         "Asia/Thimphu",
00877                         "Asia/Yekaterinburg",
00878                         "Etc/GMT-6",
00879                  ),
00880 
00881             // +390 min
00882             "Myanmar Standard Time" => array(
00883                         "Asia/Rangoon",
00884                         "Indian/Cocos",
00885                  ),
00886 
00887             // +420 min
00888             "SE Asia Standard Time" => array(
00889                         "Asia/Bangkok",
00890                         "Asia/Ho_Chi_Minh",
00891                         "Asia/Hovd",
00892                         "Asia/Jakarta",
00893                         "Asia/Phnom_Penh",
00894                         "Asia/Saigon",
00895                         "Indian/Christmas",
00896                  ),
00897             "North Asia Standard Time" => array(
00898                         "Antarctica/Davis",
00899                         "Asia/Novokuznetsk",
00900                         "Asia/Novosibirsk",
00901                         "Asia/Omsk",
00902                         "Asia/Pontianak",
00903                         "Asia/Vientiane",
00904                         "Etc/GMT-7",
00905                  ),
00906 
00907             // +480 min
00908             "China Standard Time" => array(
00909                         "Asia/Brunei",
00910                         "Asia/Choibalsan",
00911                         "Asia/Chongqing",
00912                         "Asia/Chungking",
00913                         "Asia/Harbin",
00914                         "Asia/Hong_Kong",
00915                         "Asia/Shanghai",
00916                         "Asia/Ujung_Pandang",
00917                         "Asia/Urumqi",
00918                         "Hongkong",
00919                         "PRC",
00920                         "ROC",
00921                  ),
00922             "Singapore Standard Time" => array(
00923                         "Singapore",
00924                         "Asia/Singapore",
00925                         "Asia/Kuala_Lumpur",
00926                  ),
00927             "Taipei Standard Time" => array(
00928                         "Asia/Taipei",
00929                  ),
00930             "W Australia Standard Time" => array(
00931                         "Australia/Perth",
00932                         "Australia/West",
00933                  ),
00934             "North Asia East Standard Time" => array(
00935                         "Antarctica/Casey",
00936                         "Asia/Kashgar",
00937                         "Asia/Krasnoyarsk",
00938                         "Asia/Kuching",
00939                         "Asia/Macao",
00940                         "Asia/Macau",
00941                         "Asia/Makassar",
00942                         "Asia/Manila",
00943                         "Etc/GMT-8",
00944                         "Asia/Ulaanbaatar",
00945                         "Asia/Ulan_Bator",
00946                  ),
00947 
00948             // +525 min
00949             "525" => array(
00950                         "Australia/Eucla",
00951                  ),
00952 
00953             // +540 min
00954             "Korea Standard Time" => array(
00955                         "Asia/Seoul",
00956                         "Asia/Pyongyang",
00957                         "ROK",
00958                  ),
00959             "Tokyo Standard Time" => array(
00960                         "Asia/Tokyo",
00961                         "Japan",
00962                         "Etc/GMT-9",
00963                  ),
00964             "Yakutsk Standard Time" => array(
00965                         "Asia/Dili",
00966                         "Asia/Irkutsk",
00967                         "Asia/Jayapura",
00968                         "Pacific/Palau",
00969                  ),
00970 
00971             // +570 min
00972             "AUS Central Standard Time" => array(
00973                         "Australia/Darwin",
00974                         "Australia/North",
00975                  ),
00976              // DST
00977             "Cen Australia Standard Time" => array(
00978                         "Australia/Adelaide",
00979                         "Australia/Broken_Hill",
00980                         "Australia/South",
00981                         "Australia/Yancowinna",
00982                  ),
00983 
00984             // +600 min
00985             "AUS Eastern Standard Time" => array(
00986                         "Australia/Canberra",
00987                         "Australia/Melbourne",
00988                         "Australia/Sydney",
00989                         "Australia/Currie",
00990                         "Australia/ACT",
00991                         "Australia/NSW",
00992                         "Australia/Victoria",
00993                  ),
00994             "E Australia Standard Time" => array(
00995                         "Etc/GMT-10",
00996                         "Australia/Brisbane",
00997                         "Australia/Queensland",
00998                         "Australia/Lindeman",
00999                  ),
01000             "Tasmania Standard Time" => array(
01001                         "Australia/Hobart",
01002                         "Australia/Tasmania",
01003                  ),
01004             "Vladivostok Standard Time" => array(
01005                         "Antarctica/DumontDUrville",
01006                  ),
01007             "West Pacific Standard Time" => array(
01008                         "Asia/Yakutsk",
01009                         "Pacific/Chuuk",
01010                         "Pacific/Guam",
01011                         "Pacific/Port_Moresby",
01012                         "Pacific/Saipan",
01013                         "Pacific/Truk",
01014                         "Pacific/Yap",
01015                  ),
01016 
01017             // +630 min
01018             "630" => array(
01019                         "Australia/LHI",
01020                         "Australia/Lord_Howe",
01021                  ),
01022 
01023             // +660 min
01024             "Central Pacific Standard Time" => array(
01025                         "Antarctica/Macquarie",
01026                         "Asia/Sakhalin",
01027                         "Asia/Vladivostok",
01028                         "Etc/GMT-11",
01029                         "Pacific/Efate",
01030                         "Pacific/Guadalcanal",
01031                         "Pacific/Kosrae",
01032                         "Pacific/Noumea",
01033                         "Pacific/Pohnpei",
01034                         "Pacific/Ponape",
01035                  ),
01036 
01037             // 690 min
01038             "690" => array(
01039                         "Pacific/Norfolk",
01040                  ),
01041 
01042             // +720 min
01043             "Fiji Islands Standard Time" => array(
01044                         "Asia/Anadyr",
01045                         "Asia/Kamchatka",
01046                         "Asia/Magadan",
01047                         "Kwajalein",
01048                  ),
01049             "New Zealand Standard Time" => array(
01050                         "Antarctica/McMurdo",
01051                         "Antarctica/South_Pole",
01052                         "Etc/GMT-12",
01053                         "NZ",
01054                         "Pacific/Auckland",
01055                         "Pacific/Fiji",
01056                         "Pacific/Funafuti",
01057                         "Pacific/Kwajalein",
01058                         "Pacific/Majuro",
01059                         "Pacific/Nauru",
01060                         "Pacific/Tarawa",
01061                         "Pacific/Wake",
01062                         "Pacific/Wallis",
01063                  ),
01064 
01065             // +765 min
01066             "765" => array(
01067                         "NZ-CHAT",
01068                         "Pacific/Chatham",
01069                  ),
01070 
01071             // +780 min
01072             "Tonga Standard Time" => array(
01073                         "Etc/GMT-13",
01074                         "Pacific/Apia",
01075                         "Pacific/Enderbury",
01076                         "Pacific/Tongatapu",
01077                  ),
01078 
01079             // +840 min
01080             "840" => array(
01081                         "Etc/GMT-14",
01082                         "Pacific/Fakaofo",
01083                         "Pacific/Kiritimati",
01084                  ),
01085             );
01086 
01096     static public function GetFullTZ($phptimezone = false) {
01097         if ($phptimezone === false)
01098             $phptimezone = date_default_timezone_get();
01099 
01100         ZLog::Write(LOGLEVEL_DEBUG, "TimezoneUtil::GetFullTZ() for ". $phptimezone);
01101 
01102         $servertzname = self::guessTZNameFromPHPName($phptimezone);
01103         $offset = self::$tzonesoffsets[$servertzname];
01104 
01105         $tz = array(
01106             "bias" => $offset[0],
01107             "tzname" => self::encodeTZName(self::getMSTZnameFromTZName($servertzname)),
01108             "dstendyear" => $offset[3],
01109             "dstendmonth" => $offset[4],
01110             "dstendday" => $offset[6],
01111             "dstendweek" => $offset[5],
01112             "dstendhour" => $offset[7],
01113             "dstendminute" => $offset[8],
01114             "dstendsecond" => $offset[9],
01115             "dstendmillis" => $offset[10],
01116             "stdbias" => $offset[1],
01117             "tznamedst" => self::encodeTZName(self::getMSTZnameFromTZName($servertzname)),
01118             "dststartyear" => $offset[11],
01119             "dststartmonth" => $offset[12],
01120             "dststartday" => $offset[14],
01121             "dststartweek" => $offset[13],
01122             "dststarthour" => $offset[15],
01123             "dststartminute" => $offset[16],
01124             "dststartsecond" => $offset[17],
01125             "dststartmillis" => $offset[18],
01126             "dstbias" => $offset[2]
01127         );
01128 
01129         return $tz;
01130     }
01131 
01140     static public function FillTZNames($tz) {
01141         ZLog::Write(LOGLEVEL_DEBUG, "TimezoneUtil::FillTZNames() filling up bias ". $tz["bias"]);
01142         if (!isset($tz["bias"]))
01143             ZLog::Write(LOGLEVEL_WARN, "TimezoneUtil::FillTZNames() submitted TZ array does not have a bias");
01144         else {
01145             $tzname = self::guessTZNameFromOffset($tz);
01146             $tz['tzname'] = $tz['tznamedst'] = self::encodeTZName(self::getMSTZnameFromTZName($tzname));
01147         }
01148         return $tz;
01149     }
01150 
01159     static private function guessTZNameFromOffset($offset) {
01160         // try to find a quite exact match
01161         foreach (self::$tzonesoffsets as $tzname => $tzoffset) {
01162             if ($offset["bias"] == $tzoffset[0] &&
01163                 isset($offset["dstendmonth"])   && $offset["dstendmonth"] == $tzoffset[4] &&
01164                 isset($offset["dstendday"])     && $offset["dstendday"] == $tzoffset[6] &&
01165                 isset($offset["dststartmonth"]) && $offset["dststartmonth"] == $tzoffset[12] &&
01166                 isset($offset["dststartday"])   && $offset["dststartday"] == $tzoffset[14])
01167                 return $tzname;
01168         }
01169 
01170         // try to find a bias match
01171         foreach (self::$tzonesoffsets as $tzname => $tzoffset) {
01172             if ($offset["bias"] == $tzoffset[0])
01173                 return $tzname;
01174         }
01175 
01176         // nothing found? return gmt
01177         ZLog::Write(LOGLEVEL_WARN, "TimezoneUtil::guessTZNameFromOffset() no timezone found for the data submitted. Returning 'GMT Standard Time'.");
01178         return "GMT Standard Time";
01179     }
01180 
01189     static private function guessTZNameFromPHPName($phpname) {
01190         foreach (self::$phptimezones as $tzn => $phptzs) {
01191             if (in_array($phpname, $phptzs)) {
01192                 $tzname = $tzn;
01193                 break;
01194             }
01195         }
01196 
01197         if (!isset($tzname) || is_int($tzname)) {
01198             ZLog::Write(LOGLEVEL_ERROR, sprintf("TimezoneUtil::guessTZNameFromPHPName() no compatible timezone found for '%s'. Returning 'GMT Standard Time'. Please contact the Z-Push dev team.", $phpname));
01199             return self::$mstzones["085"][0];
01200         }
01201 
01202         return $tzname;
01203     }
01204 
01213     static private function getMSTZnameFromTZName($name) {
01214         foreach (self::$mstzones as $mskey => $msdefs) {
01215             if ($name == $msdefs[0])
01216                 return $msdefs[1];
01217         }
01218 
01219         ZLog::Write(LOGLEVEL_WARN, sprintf("TimezoneUtil::getMSTZnameFromTZName() no MS name found for '%s'. Returning '(GMT) Greenwich Mean Time: Dublin, Edinburgh, Lisbon, London'", $name));
01220         return self::$mstzones["085"][1];
01221     }
01222 
01231     static private function encodeTZName($name) {
01232         return substr(iconv('UTF-8', 'UTF-16', $name),2,-1);
01233     }
01234 
01242     static public function TZtest() {
01243         foreach (self::$mstzones as $mskey => $msdefs) {
01244             if (!array_key_exists($msdefs[0], self::$tzonesoffsets))
01245                 echo "key   '". $msdefs[0]. "'   not found in tzonesoffsets\n";
01246         }
01247 
01248         foreach (self::$tzonesoffsets as $tzname => $offset) {
01249             $found = false;
01250             foreach (self::$mstzones as $mskey => $msdefs) {
01251                 if ($tzname == $msdefs[0]) {
01252                     $found = true;
01253                     break;
01254                 }
01255             }
01256             if (!$found)
01257                 echo "key    '$tzname' NOT FOUND\n";
01258         }
01259     }
01260 
01261 }
01262 
01263 ?>