diff options
| -rw-r--r-- | core/res/res/xml/preferred_time_zones.xml | 25 | ||||
| -rw-r--r-- | core/res/res/xml/time_zones_by_country.xml | 270 | ||||
| -rw-r--r-- | core/tests/coretests/src/android/util/TimeUtilsTest.java | 457 |
3 files changed, 168 insertions, 584 deletions
diff --git a/core/res/res/xml/preferred_time_zones.xml b/core/res/res/xml/preferred_time_zones.xml deleted file mode 100644 index da8553fb01d1..000000000000 --- a/core/res/res/xml/preferred_time_zones.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* //device/apps/common/assets/default/default/data/preferred_time_zones.xml -** -** Copyright 2006, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> -<timezones> - <timezone offset="-18000000">America/New_York</timezone> - <timezone offset="-21600000">America/Chicago</timezone> - <timezone offset="-25200000">America/Denver</timezone> - <timezone offset="-28800000">America/Los_Angeles</timezone> -</timezones> diff --git a/core/res/res/xml/time_zones_by_country.xml b/core/res/res/xml/time_zones_by_country.xml index 9b2bd50401b9..a685e2b8a5e5 100644 --- a/core/res/res/xml/time_zones_by_country.xml +++ b/core/res/res/xml/time_zones_by_country.xml @@ -31,11 +31,11 @@ <!-- ANTIGUA AND BARBUDA, -4:00 --> - <timezone code="ag">America/Antigua</timezone> + <timezone code="ag">America/Port_of_Spain</timezone> <!-- ANGUILLA, -4:00 --> - <timezone code="ai">America/Anguilla</timezone> + <timezone code="ai">America/Port_of_Spain</timezone> <!-- ALBANIA, 1:00 --> @@ -45,18 +45,13 @@ <timezone code="am">Asia/Yerevan</timezone> - <!-- NETHERLANDS ANTILLES, -4:00 --> - - <timezone code="an">America/Curacao</timezone> - <!-- ANGOLA, 1:00 --> - <timezone code="ao">Africa/Luanda</timezone> + <timezone code="ao">Africa/Lagos</timezone> <!-- ANTARCTICA, 12:00 --> - <timezone code="aq">Antarctica/McMurdo</timezone> - <timezone code="aq">Antarctica/South_Pole</timezone> + <timezone code="aq">Pacific/Auckland</timezone> <!-- ANTARCTICA, 10:00 --> @@ -70,15 +65,22 @@ <timezone code="aq">Antarctica/Davis</timezone> - <!-- ANTARCTICA, 6:00 --> + <!-- ANTARCTICA, 5:00 --> <timezone code="aq">Antarctica/Mawson</timezone> + + <!-- ANTARCTICA, 6:00 --> + <timezone code="aq">Antarctica/Vostok</timezone> <!-- ANTARCTICA, 3:00 --> <timezone code="aq">Antarctica/Syowa</timezone> + <!-- ANTARCTICA, 0:00 --> + + <timezone code="aq">Antarctica/Troll</timezone> + <!-- ANTARCTICA, -3:00 --> <timezone code="aq">Antarctica/Rothera</timezone> @@ -91,12 +93,14 @@ <timezone code="ar">America/Argentina/Buenos_Aires</timezone> <timezone code="ar">America/Argentina/Cordoba</timezone> + <timezone code="ar">America/Argentina/Salta</timezone> <timezone code="ar">America/Argentina/Jujuy</timezone> <timezone code="ar">America/Argentina/Tucuman</timezone> <timezone code="ar">America/Argentina/Catamarca</timezone> <timezone code="ar">America/Argentina/La_Rioja</timezone> <timezone code="ar">America/Argentina/San_Juan</timezone> <timezone code="ar">America/Argentina/Mendoza</timezone> + <timezone code="ar">America/Argentina/San_Luis</timezone> <timezone code="ar">America/Argentina/Rio_Gallegos</timezone> <timezone code="ar">America/Argentina/Ushuaia</timezone> @@ -117,6 +121,9 @@ <timezone code="au">Australia/Currie</timezone> <timezone code="au">Australia/Lindeman</timezone> + <!-- AUSTRALIA, 11:00 --> + <timezone code="au">Antarctica/Macquarie</timezone> + <!-- AUSTRALIA, 10:30 --> <timezone code="au">Australia/Lord_Howe</timezone> @@ -137,11 +144,11 @@ <!-- ARUBA, -4:00 --> - <timezone code="aw">America/Aruba</timezone> + <timezone code="aw">America/Curacao</timezone> <!-- ALAND ISLANDS, 2:00 --> - <timezone code="ax">Europe/Mariehamn</timezone> + <timezone code="ax">Europe/Helsinki</timezone> <!-- AZERBAIJAN, 4:00 --> @@ -149,7 +156,7 @@ <!-- BOSNIA AND HERZEGOVINA, 1:00 --> - <timezone code="ba">Europe/Sarajevo</timezone> + <timezone code="ba">Europe/Belgrade</timezone> <!-- BARBADOS, -4:00 --> @@ -165,7 +172,7 @@ <!-- BURKINA FASO, 0:00 --> - <timezone code="bf">Africa/Ouagadougou</timezone> + <timezone code="bf">Africa/Abidjan</timezone> <!-- BULGARIA, 2:00 --> @@ -173,15 +180,19 @@ <!-- BAHRAIN, 3:00 --> - <timezone code="bh">Asia/Bahrain</timezone> + <timezone code="bh">Asia/Qatar</timezone> <!-- BURUNDI, 2:00 --> - <timezone code="bi">Africa/Bujumbura</timezone> + <timezone code="bi">Africa/Maputo</timezone> <!-- BENIN, 1:00 --> - <timezone code="bj">Africa/Porto-Novo</timezone> + <timezone code="bj">Africa/Lagos</timezone> + + <!-- Saint Barthélemy, -4:00 --> + + <timezone code="bl">America/Port_of_Spain</timezone> <!-- BERMUDA, -4:00 --> @@ -195,6 +206,10 @@ <timezone code="bo">America/La_Paz</timezone> + <!-- Caribbean Netherlands, -4:00 --> + + <timezone code="bq">America/Curacao</timezone> + <!-- BRAZIL, -2:00 --> <timezone code="br">America/Noronha</timezone> @@ -208,6 +223,7 @@ <timezone code="br">America/Araguaina</timezone> <timezone code="br">America/Maceio</timezone> <timezone code="br">America/Bahia</timezone> + <timezone code="br">America/Santarem</timezone> <!-- BRAZIL, -4:00 --> @@ -216,6 +232,9 @@ <timezone code="br">America/Cuiaba</timezone> <timezone code="br">America/Porto_Velho</timezone> <timezone code="br">America/Boa_Vista</timezone> + + <!-- BRAZIL, -5:00 --> + <timezone code="br">America/Eirunepe</timezone> <timezone code="br">America/Rio_Branco</timezone> @@ -229,9 +248,9 @@ <!-- BOTSWANA, 2:00 --> - <timezone code="bw">Africa/Gaborone</timezone> + <timezone code="bw">Africa/Maputo</timezone> - <!-- BELARUS, 2:00 --> + <!-- BELARUS, 3:00 --> <timezone code="by">Europe/Minsk</timezone> @@ -254,12 +273,10 @@ <!-- CANADA, -5:00 --> <timezone code="ca">America/Toronto</timezone> - <timezone code="ca">America/Montreal</timezone> <timezone code="ca">America/Nipigon</timezone> <timezone code="ca">America/Thunder_Bay</timezone> <timezone code="ca">America/Iqaluit</timezone> <timezone code="ca">America/Pangnirtung</timezone> - <timezone code="ca">America/Resolute</timezone> <timezone code="ca">America/Atikokan</timezone> <!-- CANADA, -6:00 --> @@ -269,6 +286,7 @@ <timezone code="ca">America/Rankin_Inlet</timezone> <timezone code="ca">America/Rainy_River</timezone> <timezone code="ca">America/Swift_Current</timezone> + <timezone code="ca">America/Resolute</timezone> <!-- CANADA, -7:00 --> @@ -277,6 +295,8 @@ <timezone code="ca">America/Yellowknife</timezone> <timezone code="ca">America/Inuvik</timezone> <timezone code="ca">America/Dawson_Creek</timezone> + <timezone code="ca">America/Creston</timezone> + <timezone code="ca">America/Fort_Nelson</timezone> <!-- CANADA, -8:00 --> @@ -290,19 +310,19 @@ <!-- CONGO, THE DEMOCRATIC REPUBLIC OF THE, 2:00 --> - <timezone code="cd">Africa/Lubumbashi</timezone> + <timezone code="cd">Africa/Maputo</timezone> <!-- CONGO, THE DEMOCRATIC REPUBLIC OF THE, 1:00 --> - <timezone code="cd">Africa/Kinshasa</timezone> + <timezone code="cd">Africa/Lagos</timezone> <!-- CENTRAL AFRICAN REPUBLIC, 1:00 --> - <timezone code="cf">Africa/Bangui</timezone> + <timezone code="cf">Africa/Lagos</timezone> <!-- CONGO, 1:00 --> - <timezone code="cg">Africa/Brazzaville</timezone> + <timezone code="cg">Africa/Lagos</timezone> <!-- SWITZERLAND, 1:00 --> @@ -326,15 +346,15 @@ <!-- CAMEROON, 1:00 --> - <timezone code="cm">Africa/Douala</timezone> + <timezone code="cm">Africa/Lagos</timezone> <!-- CHINA, 8:00 --> <timezone code="cn">Asia/Shanghai</timezone> - <timezone code="cn">Asia/Harbin</timezone> - <timezone code="cn">Asia/Chongqing</timezone> + + <!-- CHINA, 6:00 --> + <timezone code="cn">Asia/Urumqi</timezone> - <timezone code="cn">Asia/Kashgar</timezone> <!-- COLOMBIA, -5:00 --> @@ -352,6 +372,10 @@ <timezone code="cv">Atlantic/Cape_Verde</timezone> + <!-- Curaçao, -4:00 --> + + <timezone code="cw">America/Curacao</timezone> + <!-- CHRISTMAS ISLAND, 7:00 --> <timezone code="cx">Indian/Christmas</timezone> @@ -367,10 +391,11 @@ <!-- GERMANY, 1:00 --> <timezone code="de">Europe/Berlin</timezone> + <timezone code="de">Europe/Zurich</timezone> <!-- DJIBOUTI, 3:00 --> - <timezone code="dj">Africa/Djibouti</timezone> + <timezone code="dj">Africa/Nairobi</timezone> <!-- DENMARK, 1:00 --> @@ -378,7 +403,7 @@ <!-- DOMINICA, -4:00 --> - <timezone code="dm">America/Dominica</timezone> + <timezone code="dm">America/Port_of_Spain</timezone> <!-- DOMINICAN REPUBLIC, -4:00 --> @@ -410,7 +435,7 @@ <!-- ERITREA, 3:00 --> - <timezone code="er">Africa/Asmara</timezone> + <timezone code="er">Africa/Nairobi</timezone> <!-- SPAIN, 1:00 --> @@ -423,7 +448,7 @@ <!-- ETHIOPIA, 3:00 --> - <timezone code="et">Africa/Addis_Ababa</timezone> + <timezone code="et">Africa/Nairobi</timezone> <!-- FINLAND, 2:00 --> @@ -433,7 +458,7 @@ <timezone code="fj">Pacific/Fiji</timezone> - <!-- FALKLAND ISLANDS (MALVINAS), -4:00 --> + <!-- FALKLAND ISLANDS (MALVINAS), -3:00 --> <timezone code="fk">Atlantic/Stanley</timezone> @@ -444,7 +469,7 @@ <!-- MICRONESIA, FEDERATED STATES OF, 10:00 --> - <timezone code="fm">Pacific/Truk</timezone> + <timezone code="fm">Pacific/Chuuk</timezone> <!-- FAROE ISLANDS, 0:00 --> @@ -456,7 +481,7 @@ <!-- GABON, 1:00 --> - <timezone code="ga">Africa/Libreville</timezone> + <timezone code="ga">Africa/Lagos</timezone> <!-- UNITED KINGDOM, 0:00 --> @@ -464,7 +489,7 @@ <!-- GRENADA, -4:00 --> - <timezone code="gd">America/Grenada</timezone> + <timezone code="gd">America/Port_of_Spain</timezone> <!-- GEORGIA, 4:00 --> @@ -476,7 +501,7 @@ <!-- GUERNSEY, 0:00 --> - <timezone code="gg">Europe/Guernsey</timezone> + <timezone code="gg">Europe/London</timezone> <!-- GHANA, 0:00 --> @@ -504,19 +529,19 @@ <!-- GAMBIA, 0:00 --> - <timezone code="gm">Africa/Banjul</timezone> + <timezone code="gm">Africa/Abidjan</timezone> <!-- GUINEA, 0:00 --> - <timezone code="gn">Africa/Conakry</timezone> + <timezone code="gn">Africa/Abidjan</timezone> <!-- GUADELOUPE, -4:00 --> - <timezone code="gp">America/Guadeloupe</timezone> + <timezone code="gp">America/Port_of_Spain</timezone> <!-- EQUATORIAL GUINEA, 1:00 --> - <timezone code="gq">Africa/Malabo</timezone> + <timezone code="gq">Africa/Lagos</timezone> <!-- GREECE, 2:00 --> @@ -552,7 +577,7 @@ <!-- CROATIA, 1:00 --> - <timezone code="hr">Europe/Zagreb</timezone> + <timezone code="hr">Europe/Belgrade</timezone> <!-- HAITI, -5:00 --> @@ -585,11 +610,11 @@ <!-- ISLE OF MAN, 0:00 --> - <timezone code="im">Europe/Isle_of_Man</timezone> + <timezone code="im">Europe/London</timezone> <!-- INDIA, 5:30 --> - <timezone code="in">Asia/Calcutta</timezone> + <timezone code="in">Asia/Kolkata</timezone> <!-- BRITISH INDIAN OCEAN TERRITORY, 6:00 --> @@ -613,7 +638,7 @@ <!-- JERSEY, 0:00 --> - <timezone code="je">Europe/Jersey</timezone> + <timezone code="je">Europe/London</timezone> <!-- JAMAICA, -5:00 --> @@ -637,7 +662,7 @@ <!-- CAMBODIA, 7:00 --> - <timezone code="kh">Asia/Phnom_Penh</timezone> + <timezone code="kh">Asia/Bangkok</timezone> <!-- KIRIBATI, 14:00 --> @@ -653,13 +678,13 @@ <!-- COMOROS, 3:00 --> - <timezone code="km">Indian/Comoro</timezone> + <timezone code="km">Africa/Nairobi</timezone> <!-- SAINT KITTS AND NEVIS, -4:00 --> - <timezone code="kn">America/St_Kitts</timezone> + <timezone code="kn">America/Port_of_Spain</timezone> - <!-- KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF, 9:00 --> + <!-- KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF, 8:30 --> <timezone code="kp">Asia/Pyongyang</timezone> @@ -669,11 +694,11 @@ <!-- KUWAIT, 3:00 --> - <timezone code="kw">Asia/Kuwait</timezone> + <timezone code="kw">Asia/Riyadh</timezone> <!-- CAYMAN ISLANDS, -5:00 --> - <timezone code="ky">America/Cayman</timezone> + <timezone code="ky">America/Panama</timezone> <!-- KAZAKHSTAN, 6:00 --> @@ -688,7 +713,7 @@ <!-- LAO PEOPLE'S DEMOCRATIC REPUBLIC, 7:00 --> - <timezone code="la">Asia/Vientiane</timezone> + <timezone code="la">Asia/Bangkok</timezone> <!-- LEBANON, 2:00 --> @@ -696,11 +721,11 @@ <!-- SAINT LUCIA, -4:00 --> - <timezone code="lc">America/St_Lucia</timezone> + <timezone code="lc">America/Port_of_Spain</timezone> <!-- LIECHTENSTEIN, 1:00 --> - <timezone code="li">Europe/Vaduz</timezone> + <timezone code="li">Europe/Zurich</timezone> <!-- SRI LANKA, 5:30 --> @@ -712,7 +737,7 @@ <!-- LESOTHO, 2:00 --> - <timezone code="ls">Africa/Maseru</timezone> + <timezone code="ls">Africa/Johannesburg</timezone> <!-- LITHUANIA, 2:00 --> @@ -744,11 +769,15 @@ <!-- MONTENEGRO, 1:00 --> - <timezone code="me">Europe/Podgorica</timezone> + <timezone code="me">Europe/Belgrade</timezone> + + <!-- Collectivity of Saint Martin, -4:00 --> + + <timezone code="mf">America/Port_of_Spain</timezone> <!-- MADAGASCAR, 3:00 --> - <timezone code="mg">Indian/Antananarivo</timezone> + <timezone code="mg">Africa/Nairobi</timezone> <!-- MARSHALL ISLANDS, 12:00 --> @@ -757,15 +786,15 @@ <!-- MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF, 1:00 --> - <timezone code="mk">Europe/Skopje</timezone> + <timezone code="mk">Europe/Belgrade</timezone> <!-- MALI, 0:00 --> - <timezone code="ml">Africa/Bamako</timezone> + <timezone code="ml">Africa/Abidjan</timezone> <!-- MYANMAR, 6:30 --> - <timezone code="mm">Asia/Rangoon</timezone> + <timezone code="mm">Asia/Yangon</timezone> <!-- MONGOLIA, 8:00 --> @@ -782,7 +811,7 @@ <!-- NORTHERN MARIANA ISLANDS, 10:00 --> - <timezone code="mp">Pacific/Saipan</timezone> + <timezone code="mp">Pacific/Guam</timezone> <!-- MARTINIQUE, -4:00 --> @@ -790,11 +819,11 @@ <!-- MAURITANIA, 0:00 --> - <timezone code="mr">Africa/Nouakchott</timezone> + <timezone code="mr">Africa/Abidjan</timezone> <!-- MONTSERRAT, -4:00 --> - <timezone code="ms">America/Montserrat</timezone> + <timezone code="ms">America/Port_of_Spain</timezone> <!-- MALTA, 1:00 --> @@ -810,20 +839,26 @@ <!-- MALAWI, 2:00 --> - <timezone code="mw">Africa/Blantyre</timezone> + <timezone code="mw">Africa/Maputo</timezone> <!-- MEXICO, -6:00 --> <timezone code="mx">America/Mexico_City</timezone> - <timezone code="mx">America/Cancun</timezone> <timezone code="mx">America/Merida</timezone> <timezone code="mx">America/Monterrey</timezone> + <timezone code="mx">America/Matamoros</timezone> + <timezone code="mx">America/Bahia_Banderas</timezone> + + <!-- MEXICO, -5:00 --> + + <timezone code="mx">America/Cancun</timezone> <!-- MEXICO, -7:00 --> <timezone code="mx">America/Chihuahua</timezone> <timezone code="mx">America/Hermosillo</timezone> <timezone code="mx">America/Mazatlan</timezone> + <timezone code="mx">America/Ojinaga</timezone> <!-- MEXICO, -8:00 --> @@ -848,7 +883,7 @@ <!-- NIGER, 1:00 --> - <timezone code="ne">Africa/Niamey</timezone> + <timezone code="ne">Africa/Lagos</timezone> <!-- NORFOLK ISLAND, 11:30 --> @@ -892,7 +927,7 @@ <!-- OMAN, 4:00 --> - <timezone code="om">Asia/Muscat</timezone> + <timezone code="om">Asia/Dubai</timezone> <!-- PANAMA, -5:00 --> @@ -918,6 +953,10 @@ <timezone code="pg">Pacific/Port_Moresby</timezone> + <!-- PAPUA NEW GUINEA, 11:00 --> + + <timezone code="pg">Pacific/Bougainville</timezone> + <!-- PHILIPPINES, 8:00 --> <timezone code="ph">Asia/Manila</timezone> @@ -945,6 +984,7 @@ <!-- PALESTINE, 2:00 --> <timezone code="ps">Asia/Gaza</timezone> + <timezone code="ps">Asia/Hebron</timezone> <!-- PORTUGAL, 0:00 --> @@ -987,15 +1027,19 @@ <!-- RUSSIAN FEDERATION, 11:00 --> <timezone code="ru">Asia/Magadan</timezone> + <timezone code="ru">Asia/Sakhalin</timezone> + <timezone code="ru">Asia/Srednekolymsk</timezone> <!-- RUSSIAN FEDERATION, 10:00 --> <timezone code="ru">Asia/Vladivostok</timezone> - <timezone code="ru">Asia/Sakhalin</timezone> + <timezone code="ru">Asia/Ust-Nera</timezone> <!-- RUSSIAN FEDERATION, 9:00 --> <timezone code="ru">Asia/Yakutsk</timezone> + <timezone code="ru">Asia/Chita</timezone> + <timezone code="ru">Asia/Khandyga</timezone> <!-- RUSSIAN FEDERATION, 8:00 --> @@ -1004,10 +1048,13 @@ <!-- RUSSIAN FEDERATION, 7:00 --> <timezone code="ru">Asia/Krasnoyarsk</timezone> + <timezone code="ru">Asia/Novosibirsk</timezone> + <timezone code="ru">Asia/Barnaul</timezone> + <timezone code="ru">Asia/Novokuznetsk</timezone> + <timezone code="ru">Asia/Tomsk</timezone> <!-- RUSSIAN FEDERATION, 6:00 --> - <timezone code="ru">Asia/Novosibirsk</timezone> <timezone code="ru">Asia/Omsk</timezone> <!-- RUSSIAN FEDERATION, 5:00 --> @@ -1017,11 +1064,15 @@ <!-- RUSSIAN FEDERATION, 4:00 --> <timezone code="ru">Europe/Samara</timezone> + <timezone code="ru">Europe/Astrakhan</timezone> + <timezone code="ru">Europe/Ulyanovsk</timezone> <!-- RUSSIAN FEDERATION, 3:00 --> <timezone code="ru">Europe/Moscow</timezone> <timezone code="ru">Europe/Volgograd</timezone> + <timezone code="ru">Europe/Kirov</timezone> + <timezone code="ru">Europe/Simferopol</timezone> <!-- RUSSIAN FEDERATION, 2:00 --> @@ -1029,7 +1080,7 @@ <!-- RWANDA, 2:00 --> - <timezone code="rw">Africa/Kigali</timezone> + <timezone code="rw">Africa/Maputo</timezone> <!-- SAUDI ARABIA, 3:00 --> @@ -1057,57 +1108,65 @@ <!-- SAINT HELENA, 0:00 --> - <timezone code="sh">Atlantic/St_Helena</timezone> + <timezone code="sh">Africa/Abidjan</timezone> <!-- SLOVENIA, 1:00 --> - <timezone code="si">Europe/Ljubljana</timezone> + <timezone code="si">Europe/Belgrade</timezone> <!-- SVALBARD AND JAN MAYEN, 1:00 --> - <timezone code="sj">Arctic/Longyearbyen</timezone> + <timezone code="sj">Europe/Oslo</timezone> <!-- SLOVAKIA, 1:00 --> - <timezone code="sk">Europe/Bratislava</timezone> + <timezone code="sk">Europe/Prague</timezone> <!-- SIERRA LEONE, 0:00 --> - <timezone code="sl">Africa/Freetown</timezone> + <timezone code="sl">Africa/Abidjan</timezone> <!-- SAN MARINO, 1:00 --> - <timezone code="sm">Europe/San_Marino</timezone> + <timezone code="sm">Europe/Rome</timezone> <!-- SENEGAL, 0:00 --> - <timezone code="sn">Africa/Dakar</timezone> + <timezone code="sn">Africa/Abidjan</timezone> <!-- SOMALIA, 3:00 --> - <timezone code="so">Africa/Mogadishu</timezone> + <timezone code="so">Africa/Nairobi</timezone> <!-- SURINAME, -3:00 --> <timezone code="sr">America/Paramaribo</timezone> + <!-- South Sudan, 3:00 --> + + <timezone code="ss">Africa/Khartoum</timezone> + <!-- SAO TOME AND PRINCIPE, 0:00 --> - <timezone code="st">Africa/Sao_Tome</timezone> + <timezone code="st">Africa/Abidjan</timezone> <!-- EL SALVADOR, -6:00 --> <timezone code="sv">America/El_Salvador</timezone> + <!-- Sint Maarten, -4:00 --> + + <timezone code="sx">America/Curacao</timezone> + <!-- SYRIAN ARAB REPUBLIC, 2:00 --> <timezone code="sy">Asia/Damascus</timezone> <!-- SWAZILAND, 2:00 --> - <timezone code="sz">Africa/Mbabane</timezone> + <timezone code="sz">Africa/Johannesburg</timezone> - <!-- TURKS AND CAICOS ISLANDS, -5:00 --> + <!-- TURKS AND CAICOS ISLANDS, -4:00 --> <timezone code="tc">America/Grand_Turk</timezone> @@ -1119,9 +1178,13 @@ <timezone code="tf">Indian/Kerguelen</timezone> + <!-- FRENCH SOUTHERN TERRITORIES, 4:00 --> + + <timezone code="tf">Indian/Reunion</timezone> + <!-- TOGO, 0:00 --> - <timezone code="tg">Africa/Lome</timezone> + <timezone code="tg">Africa/Abidjan</timezone> <!-- THAILAND, 7:00 --> @@ -1131,7 +1194,7 @@ <timezone code="tj">Asia/Dushanbe</timezone> - <!-- TOKELAU, -10:00 --> + <!-- TOKELAU, +13:00 --> <timezone code="tk">Pacific/Fakaofo</timezone> @@ -1151,7 +1214,7 @@ <timezone code="to">Pacific/Tongatapu</timezone> - <!-- TURKEY, 2:00 --> + <!-- TURKEY, 3:00 --> <timezone code="tr">Europe/Istanbul</timezone> @@ -1169,18 +1232,17 @@ <!-- TANZANIA, UNITED REPUBLIC OF, 3:00 --> - <timezone code="tz">Africa/Dar_es_Salaam</timezone> + <timezone code="tz">Africa/Nairobi</timezone> <!-- UKRAINE, 2:00 --> <timezone code="ua">Europe/Kiev</timezone> <timezone code="ua">Europe/Uzhgorod</timezone> <timezone code="ua">Europe/Zaporozhye</timezone> - <timezone code="ua">Europe/Simferopol</timezone> <!-- UGANDA, 3:00 --> - <timezone code="ug">Africa/Kampala</timezone> + <timezone code="ug">Africa/Nairobi</timezone> <!-- UNITED STATES MINOR OUTLYING ISLANDS, 12:00 --> @@ -1188,11 +1250,11 @@ <!-- UNITED STATES MINOR OUTLYING ISLANDS, -10:00 --> - <timezone code="um">Pacific/Johnston</timezone> + <timezone code="um">Pacific/Honolulu</timezone> <!-- UNITED STATES MINOR OUTLYING ISLANDS, -11:00 --> - <timezone code="um">Pacific/Midway</timezone> + <timezone code="um">Pacific/Pago_Pago</timezone> <!-- UNITED STATES, -5:00 --> @@ -1214,12 +1276,13 @@ <timezone code="us">America/Menominee</timezone> <timezone code="us">America/North_Dakota/Center</timezone> <timezone code="us">America/North_Dakota/New_Salem</timezone> + <timezone code="us">America/Indiana/Tell_City</timezone> + <timezone code="us">America/North_Dakota/Beulah</timezone> <!-- UNITED STATES, -7:00 --> <timezone code="us">America/Denver</timezone> <timezone code="us">America/Boise</timezone> - <timezone code="us">America/Shiprock</timezone> <timezone code="us">America/Phoenix</timezone> <!-- UNITED STATES, -8:00 --> @@ -1232,6 +1295,8 @@ <timezone code="us">America/Juneau</timezone> <timezone code="us">America/Yakutat</timezone> <timezone code="us">America/Nome</timezone> + <timezone code="us">America/Metlakatla</timezone> + <timezone code="us">America/Sitka</timezone> <!-- UNITED STATES, -10:00 --> @@ -1249,27 +1314,28 @@ <!-- HOLY SEE (VATICAN CITY STATE), 1:00 --> - <timezone code="va">Europe/Vatican</timezone> + <timezone code="va">Europe/Rome</timezone> <!-- SAINT VINCENT AND THE GRENADINES, -4:00 --> - <timezone code="vc">America/St_Vincent</timezone> + <timezone code="vc">America/Port_of_Spain</timezone> - <!-- VENEZUELA, -4:30 --> + <!-- VENEZUELA, -4:00 --> <timezone code="ve">America/Caracas</timezone> <!-- VIRGIN ISLANDS, BRITISH, -4:00 --> - <timezone code="vg">America/Tortola</timezone> + <timezone code="vg">America/Port_of_Spain</timezone> <!-- VIRGIN ISLANDS, U.S., -4:00 --> - <timezone code="vi">America/St_Thomas</timezone> + <timezone code="vi">America/Port_of_Spain</timezone> <!-- VIET NAM, 7:00 --> - <timezone code="vn">Asia/Saigon</timezone> + <timezone code="vn">Asia/Ho_Chi_Minh</timezone> + <timezone code="vn">Asia/Bangkok</timezone> <!-- VANUATU, 11:00 --> @@ -1279,17 +1345,17 @@ <timezone code="wf">Pacific/Wallis</timezone> - <!-- SAMOA, -11:00 --> + <!-- SAMOA, 13:00 --> <timezone code="ws">Pacific/Apia</timezone> <!-- YEMEN, 3:00 --> - <timezone code="ye">Asia/Aden</timezone> + <timezone code="ye">Asia/Riyadh</timezone> <!-- MAYOTTE, 3:00 --> - <timezone code="yt">Indian/Mayotte</timezone> + <timezone code="yt">Africa/Nairobi</timezone> <!-- SOUTH AFRICA, 2:00 --> @@ -1297,9 +1363,9 @@ <!-- ZAMBIA, 2:00 --> - <timezone code="zm">Africa/Lusaka</timezone> + <timezone code="zm">Africa/Maputo</timezone> <!-- ZIMBABWE, 2:00 --> - <timezone code="zw">Africa/Harare</timezone> + <timezone code="zw">Africa/Maputo</timezone> </timezones> diff --git a/core/tests/coretests/src/android/util/TimeUtilsTest.java b/core/tests/coretests/src/android/util/TimeUtilsTest.java deleted file mode 100644 index 237062748f9f..000000000000 --- a/core/tests/coretests/src/android/util/TimeUtilsTest.java +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Copyright (C) 2008 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.util; - -import junit.framework.TestCase; - -import java.util.Calendar; -import java.util.TimeZone; - -/** - * TimeUtilsTest tests the time zone guesser. - */ -public class TimeUtilsTest extends TestCase { - public void testMainstream() throws Exception { - String[] mainstream = new String[] { - "America/New_York", // Eastern - "America/Chicago", // Central - "America/Denver", // Mountain - "America/Los_Angeles", // Pacific - "America/Anchorage", // Alaska - "Pacific/Honolulu", // Hawaii, no DST - }; - - for (String name : mainstream) { - TimeZone tz = TimeZone.getTimeZone(name); - Calendar c = Calendar.getInstance(tz); - TimeZone guess; - - c.set(2008, Calendar.OCTOBER, 20, 12, 00, 00); - guess = guess(c, "us"); - assertEquals(name, guess.getID()); - - c.set(2009, Calendar.JANUARY, 20, 12, 00, 00); - guess = guess(c, "us"); - assertEquals(name, guess.getID()); - } - } - - public void testWeird() throws Exception { - String[] weird = new String[] { - "America/Phoenix", // Mountain, no DST - "America/Adak", // Same as Hawaii, but with DST - }; - - for (String name : weird) { - TimeZone tz = TimeZone.getTimeZone(name); - Calendar c = Calendar.getInstance(tz); - TimeZone guess; - - c.set(2008, Calendar.OCTOBER, 20, 12, 00, 00); - guess = guess(c, "us"); - assertEquals(name, guess.getID()); - } - } - - public void testOld() throws Exception { - String[] old = new String[] { - "America/Indiana/Indianapolis", // Eastern, formerly no DST - }; - - for (String name : old) { - TimeZone tz = TimeZone.getTimeZone(name); - Calendar c = Calendar.getInstance(tz); - TimeZone guess; - - c.set(2005, Calendar.OCTOBER, 20, 12, 00, 00); - guess = guess(c, "us"); - assertEquals(name, guess.getID()); - } - } - - public void testWorld() throws Exception { - String[] world = new String[] { - "ad", "Europe/Andorra", - "ae", "Asia/Dubai", - "af", "Asia/Kabul", - "ag", "America/Antigua", - "ai", "America/Anguilla", - "al", "Europe/Tirane", - "am", "Asia/Yerevan", - "an", "America/Curacao", - "ao", "Africa/Luanda", - "aq", "Antarctica/McMurdo", - "aq", "Antarctica/DumontDUrville", - "aq", "Antarctica/Casey", - "aq", "Antarctica/Davis", - "aq", "Antarctica/Mawson", - "aq", "Antarctica/Syowa", - "aq", "Antarctica/Rothera", - "aq", "Antarctica/Palmer", - "ar", "America/Argentina/Buenos_Aires", - "as", "Pacific/Pago_Pago", - "at", "Europe/Vienna", - "au", "Australia/Sydney", - "au", "Australia/Adelaide", - "au", "Australia/Perth", - "au", "Australia/Eucla", - "aw", "America/Aruba", - "ax", "Europe/Mariehamn", - "az", "Asia/Baku", - "ba", "Europe/Sarajevo", - "bb", "America/Barbados", - "bd", "Asia/Dhaka", - "be", "Europe/Brussels", - "bf", "Africa/Ouagadougou", - "bg", "Europe/Sofia", - "bh", "Asia/Bahrain", - "bi", "Africa/Bujumbura", - "bj", "Africa/Porto-Novo", - "bm", "Atlantic/Bermuda", - "bn", "Asia/Brunei", - "bo", "America/La_Paz", - "br", "America/Noronha", - "br", "America/Sao_Paulo", - "br", "America/Manaus", - "bs", "America/Nassau", - "bt", "Asia/Thimphu", - "bw", "Africa/Gaborone", - "by", "Europe/Minsk", - "bz", "America/Belize", - "ca", "America/St_Johns", - "ca", "America/Halifax", - "ca", "America/Toronto", - "ca", "America/Winnipeg", - "ca", "America/Edmonton", - "ca", "America/Vancouver", - "cc", "Indian/Cocos", - "cd", "Africa/Lubumbashi", - "cd", "Africa/Kinshasa", - "cf", "Africa/Bangui", - "cg", "Africa/Brazzaville", - "ch", "Europe/Zurich", - "ci", "Africa/Abidjan", - "ck", "Pacific/Rarotonga", - "cl", "America/Santiago", - "cl", "Pacific/Easter", - "cm", "Africa/Douala", - "cn", "Asia/Shanghai", - "co", "America/Bogota", - "cr", "America/Costa_Rica", - "cu", "America/Havana", - "cv", "Atlantic/Cape_Verde", - "cx", "Indian/Christmas", - "cy", "Asia/Nicosia", - "cz", "Europe/Prague", - "de", "Europe/Berlin", - "dj", "Africa/Djibouti", - "dk", "Europe/Copenhagen", - "dm", "America/Dominica", - "do", "America/Santo_Domingo", - "dz", "Africa/Algiers", - "ec", "America/Guayaquil", - "ec", "Pacific/Galapagos", - "ee", "Europe/Tallinn", - "eg", "Africa/Cairo", - "eh", "Africa/El_Aaiun", - "er", "Africa/Asmara", - "es", "Europe/Madrid", - "es", "Atlantic/Canary", - "et", "Africa/Addis_Ababa", - "fi", "Europe/Helsinki", - "fj", "Pacific/Fiji", - "fk", "Atlantic/Stanley", - "fm", "Pacific/Ponape", - "fm", "Pacific/Truk", - "fo", "Atlantic/Faroe", - "fr", "Europe/Paris", - "ga", "Africa/Libreville", - "gb", "Europe/London", - "gd", "America/Grenada", - "ge", "Asia/Tbilisi", - "gf", "America/Cayenne", - "gg", "Europe/Guernsey", - "gh", "Africa/Accra", - "gi", "Europe/Gibraltar", - "gl", "America/Danmarkshavn", - "gl", "America/Scoresbysund", - "gl", "America/Godthab", - "gl", "America/Thule", - "gm", "Africa/Banjul", - "gn", "Africa/Conakry", - "gp", "America/Guadeloupe", - "gq", "Africa/Malabo", - "gr", "Europe/Athens", - "gs", "Atlantic/South_Georgia", - "gt", "America/Guatemala", - "gu", "Pacific/Guam", - "gw", "Africa/Bissau", - "gy", "America/Guyana", - "hk", "Asia/Hong_Kong", - "hn", "America/Tegucigalpa", - "hr", "Europe/Zagreb", - "ht", "America/Port-au-Prince", - "hu", "Europe/Budapest", - "id", "Asia/Jayapura", - "id", "Asia/Makassar", - "id", "Asia/Jakarta", - "ie", "Europe/Dublin", - "il", "Asia/Jerusalem", - "im", "Europe/Isle_of_Man", - "in", "Asia/Calcutta", - "io", "Indian/Chagos", - "iq", "Asia/Baghdad", - "ir", "Asia/Tehran", - "is", "Atlantic/Reykjavik", - "it", "Europe/Rome", - "je", "Europe/Jersey", - "jm", "America/Jamaica", - "jo", "Asia/Amman", - "jp", "Asia/Tokyo", - "ke", "Africa/Nairobi", - "kg", "Asia/Bishkek", - "kh", "Asia/Phnom_Penh", - "ki", "Pacific/Kiritimati", - "ki", "Pacific/Enderbury", - "ki", "Pacific/Tarawa", - "km", "Indian/Comoro", - "kn", "America/St_Kitts", - "kp", "Asia/Pyongyang", - "kr", "Asia/Seoul", - "kw", "Asia/Kuwait", - "ky", "America/Cayman", - "kz", "Asia/Almaty", - "kz", "Asia/Aqtau", - "la", "Asia/Vientiane", - "lb", "Asia/Beirut", - "lc", "America/St_Lucia", - "li", "Europe/Vaduz", - "lk", "Asia/Colombo", - "lr", "Africa/Monrovia", - "ls", "Africa/Maseru", - "lt", "Europe/Vilnius", - "lu", "Europe/Luxembourg", - "lv", "Europe/Riga", - "ly", "Africa/Tripoli", - "ma", "Africa/Casablanca", - "mc", "Europe/Monaco", - "md", "Europe/Chisinau", - "me", "Europe/Podgorica", - "mg", "Indian/Antananarivo", - "mh", "Pacific/Majuro", - "mk", "Europe/Skopje", - "ml", "Africa/Bamako", - "mm", "Asia/Rangoon", - "mn", "Asia/Choibalsan", - "mn", "Asia/Hovd", - "mo", "Asia/Macau", - "mp", "Pacific/Saipan", - "mq", "America/Martinique", - "mr", "Africa/Nouakchott", - "ms", "America/Montserrat", - "mt", "Europe/Malta", - "mu", "Indian/Mauritius", - "mv", "Indian/Maldives", - "mw", "Africa/Blantyre", - "mx", "America/Mexico_City", - "mx", "America/Chihuahua", - "mx", "America/Tijuana", - "my", "Asia/Kuala_Lumpur", - "mz", "Africa/Maputo", - "na", "Africa/Windhoek", - "nc", "Pacific/Noumea", - "ne", "Africa/Niamey", - "nf", "Pacific/Norfolk", - "ng", "Africa/Lagos", - "ni", "America/Managua", - "nl", "Europe/Amsterdam", - "no", "Europe/Oslo", - "np", "Asia/Katmandu", - "nr", "Pacific/Nauru", - "nu", "Pacific/Niue", - "nz", "Pacific/Auckland", - "nz", "Pacific/Chatham", - "om", "Asia/Muscat", - "pa", "America/Panama", - "pe", "America/Lima", - "pf", "Pacific/Gambier", - "pf", "Pacific/Marquesas", - "pf", "Pacific/Tahiti", - "pg", "Pacific/Port_Moresby", - "ph", "Asia/Manila", - "pk", "Asia/Karachi", - "pl", "Europe/Warsaw", - "pm", "America/Miquelon", - "pn", "Pacific/Pitcairn", - "pr", "America/Puerto_Rico", - "ps", "Asia/Gaza", - "pt", "Europe/Lisbon", - "pt", "Atlantic/Azores", - "pw", "Pacific/Palau", - "py", "America/Asuncion", - "qa", "Asia/Qatar", - "re", "Indian/Reunion", - "ro", "Europe/Bucharest", - "rs", "Europe/Belgrade", - "ru", "Asia/Kamchatka", - "ru", "Asia/Magadan", - "ru", "Asia/Vladivostok", - "ru", "Asia/Yakutsk", - "ru", "Asia/Irkutsk", - "ru", "Asia/Krasnoyarsk", - "ru", "Asia/Novosibirsk", - "ru", "Asia/Yekaterinburg", - "ru", "Europe/Samara", - "ru", "Europe/Moscow", - "ru", "Europe/Kaliningrad", - "rw", "Africa/Kigali", - "sa", "Asia/Riyadh", - "sb", "Pacific/Guadalcanal", - "sc", "Indian/Mahe", - "sd", "Africa/Khartoum", - "se", "Europe/Stockholm", - "sg", "Asia/Singapore", - "sh", "Atlantic/St_Helena", - "si", "Europe/Ljubljana", - "sj", "Arctic/Longyearbyen", - "sk", "Europe/Bratislava", - "sl", "Africa/Freetown", - "sm", "Europe/San_Marino", - "sn", "Africa/Dakar", - "so", "Africa/Mogadishu", - "sr", "America/Paramaribo", - "st", "Africa/Sao_Tome", - "sv", "America/El_Salvador", - "sy", "Asia/Damascus", - "sz", "Africa/Mbabane", - "tc", "America/Grand_Turk", - "td", "Africa/Ndjamena", - "tf", "Indian/Kerguelen", - "tg", "Africa/Lome", - "th", "Asia/Bangkok", - "tj", "Asia/Dushanbe", - "tk", "Pacific/Fakaofo", - "tl", "Asia/Dili", - "tm", "Asia/Ashgabat", - "tn", "Africa/Tunis", - "to", "Pacific/Tongatapu", - "tr", "Europe/Istanbul", - "tt", "America/Port_of_Spain", - "tv", "Pacific/Funafuti", - "tw", "Asia/Taipei", - "tz", "Africa/Dar_es_Salaam", - "ua", "Europe/Kiev", - "ug", "Africa/Kampala", - "um", "Pacific/Wake", - "um", "Pacific/Johnston", - "um", "Pacific/Midway", - "us", "America/New_York", - "us", "America/Chicago", - "us", "America/Denver", - "us", "America/Los_Angeles", - "us", "America/Anchorage", - "us", "Pacific/Honolulu", - "uy", "America/Montevideo", - "uz", "Asia/Tashkent", - "va", "Europe/Vatican", - "vc", "America/St_Vincent", - "ve", "America/Caracas", - "vg", "America/Tortola", - "vi", "America/St_Thomas", - "vn", "Asia/Saigon", - "vu", "Pacific/Efate", - "wf", "Pacific/Wallis", - "ws", "Pacific/Apia", - "ye", "Asia/Aden", - "yt", "Indian/Mayotte", - "za", "Africa/Johannesburg", - "zm", "Africa/Lusaka", - "zw", "Africa/Harare", - }; - - for (int i = 0; i < world.length; i += 2) { - String country = world[i]; - String name = world[i + 1]; - - TimeZone tz = TimeZone.getTimeZone(name); - Calendar c = Calendar.getInstance(tz); - TimeZone guess; - - c.set(2009, Calendar.JULY, 20, 12, 00, 00); - guess = guess(c, country); - assertEquals(name, guess.getID()); - - c.set(2009, Calendar.JANUARY, 20, 12, 00, 00); - guess = guess(c, country); - assertEquals(name, guess.getID()); - } - } - - public void testWorldWeird() throws Exception { - String[] world = new String[] { - // Distinguisable from Sydney only when DST not in effect - "au", "Australia/Lord_Howe", - }; - - for (int i = 0; i < world.length; i += 2) { - String country = world[i]; - String name = world[i + 1]; - - TimeZone tz = TimeZone.getTimeZone(name); - Calendar c = Calendar.getInstance(tz); - TimeZone guess; - - c.set(2009, Calendar.JULY, 20, 12, 00, 00); - guess = guess(c, country); - assertEquals(name, guess.getID()); - } - } - - private static TimeZone guess(Calendar c, String country) { - return TimeUtils.getTimeZone(c.get(c.ZONE_OFFSET) + c.get(c.DST_OFFSET), - c.get(c.DST_OFFSET) != 0, - c.getTimeInMillis(), - country); - } - - public void testFormatDuration() { - assertFormatDuration("0", 0); - assertFormatDuration("-1ms", -1); - assertFormatDuration("+1ms", 1); - assertFormatDuration("+10ms", 10); - assertFormatDuration("+100ms", 100); - assertFormatDuration("+101ms", 101); - assertFormatDuration("+330ms", 330); - assertFormatDuration("+1s0ms", 1000); - assertFormatDuration("+1s330ms", 1330); - assertFormatDuration("+10s24ms", 10024); - assertFormatDuration("+1m0s30ms", 60030); - assertFormatDuration("+1h0m0s30ms", 3600030); - assertFormatDuration("+1d0h0m0s30ms", 86400030); - } - - public void testFormatHugeDuration() { - assertFormatDuration("+15542d1h11m11s555ms", 1342833071555L); - assertFormatDuration("-15542d1h11m11s555ms", -1342833071555L); - } - - private void assertFormatDuration(String expected, long duration) { - StringBuilder sb = new StringBuilder(); - TimeUtils.formatDuration(duration, sb); - assertEquals("formatDuration(" + duration + ")", expected, sb.toString()); - } -} |