tzinfo 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of tzinfo might be problematic. Click here for more details.
- data/CHANGES +222 -172
- data/README +21 -4
- data/Rakefile +27 -12
- data/lib/tzinfo.rb +5 -2
- data/lib/tzinfo/country.rb +100 -90
- data/lib/tzinfo/country_index_definition.rb +50 -0
- data/lib/tzinfo/country_info.rb +82 -0
- data/lib/tzinfo/country_timezone.rb +103 -0
- data/lib/tzinfo/data_timezone.rb +47 -0
- data/lib/tzinfo/data_timezone_info.rb +226 -0
- data/lib/tzinfo/definitions/Africa/Abidjan.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Accra.rb +31 -25
- data/lib/tzinfo/definitions/Africa/Addis_Ababa.rb +18 -12
- data/lib/tzinfo/definitions/Africa/Algiers.rb +53 -44
- data/lib/tzinfo/definitions/Africa/Asmera.rb +20 -13
- data/lib/tzinfo/definitions/Africa/Bamako.rb +19 -13
- data/lib/tzinfo/definitions/Africa/Bangui.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Banjul.rb +20 -13
- data/lib/tzinfo/definitions/Africa/Bissau.rb +18 -12
- data/lib/tzinfo/definitions/Africa/Blantyre.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Brazzaville.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Bujumbura.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Cairo.rb +217 -211
- data/lib/tzinfo/definitions/Africa/Casablanca.rb +36 -29
- data/lib/tzinfo/definitions/Africa/Ceuta.rb +170 -162
- data/lib/tzinfo/definitions/Africa/Conakry.rb +19 -13
- data/lib/tzinfo/definitions/Africa/Dakar.rb +18 -12
- data/lib/tzinfo/definitions/Africa/Dar_es_Salaam.rb +19 -13
- data/lib/tzinfo/definitions/Africa/Djibouti.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Douala.rb +16 -11
- data/lib/tzinfo/definitions/Africa/El_Aaiun.rb +18 -12
- data/lib/tzinfo/definitions/Africa/Freetown.rb +51 -41
- data/lib/tzinfo/definitions/Africa/Gaborone.rb +19 -13
- data/lib/tzinfo/definitions/Africa/Harare.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Johannesburg.rb +23 -16
- data/lib/tzinfo/definitions/Africa/Kampala.rb +21 -14
- data/lib/tzinfo/definitions/Africa/Khartoum.rb +51 -44
- data/lib/tzinfo/definitions/Africa/Kigali.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Kinshasa.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Lagos.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Libreville.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Lome.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Luanda.rb +18 -12
- data/lib/tzinfo/definitions/Africa/Lubumbashi.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Lusaka.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Malabo.rb +18 -12
- data/lib/tzinfo/definitions/Africa/Maputo.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Maseru.rb +19 -13
- data/lib/tzinfo/definitions/Africa/Mbabane.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Mogadishu.rb +19 -13
- data/lib/tzinfo/definitions/Africa/Monrovia.rb +20 -13
- data/lib/tzinfo/definitions/Africa/Nairobi.rb +21 -14
- data/lib/tzinfo/definitions/Africa/Ndjamena.rb +19 -13
- data/lib/tzinfo/definitions/Africa/Niamey.rb +20 -13
- data/lib/tzinfo/definitions/Africa/Nouakchott.rb +19 -13
- data/lib/tzinfo/definitions/Africa/Ouagadougou.rb +16 -11
- data/lib/tzinfo/definitions/Africa/Porto__m__Novo.rb +18 -12
- data/lib/tzinfo/definitions/Africa/Sao_Tome.rb +18 -12
- data/lib/tzinfo/definitions/Africa/Timbuktu.rb +11 -10
- data/lib/tzinfo/definitions/Africa/Tripoli.rb +46 -39
- data/lib/tzinfo/definitions/Africa/Tunis.rb +135 -128
- data/lib/tzinfo/definitions/Africa/Windhoek.rb +138 -128
- data/lib/tzinfo/definitions/America/Adak.rb +194 -181
- data/lib/tzinfo/definitions/America/Anchorage.rb +194 -181
- data/lib/tzinfo/definitions/America/Anguilla.rb +16 -11
- data/lib/tzinfo/definitions/America/Antigua.rb +18 -12
- data/lib/tzinfo/definitions/America/Araguaina.rb +65 -59
- data/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb +78 -69
- data/lib/tzinfo/definitions/America/Argentina/Catamarca.rb +81 -71
- data/lib/tzinfo/definitions/America/Argentina/ComodRivadavia.rb +13 -12
- data/lib/tzinfo/definitions/America/Argentina/Cordoba.rb +79 -69
- data/lib/tzinfo/definitions/America/Argentina/Jujuy.rb +80 -69
- data/lib/tzinfo/definitions/America/Argentina/La_Rioja.rb +82 -72
- data/lib/tzinfo/definitions/America/Argentina/Mendoza.rb +82 -71
- data/lib/tzinfo/definitions/America/Argentina/Rio_Gallegos.rb +81 -71
- data/lib/tzinfo/definitions/America/Argentina/San_Juan.rb +82 -72
- data/lib/tzinfo/definitions/America/Argentina/Tucuman.rb +81 -71
- data/lib/tzinfo/definitions/America/Argentina/Ushuaia.rb +81 -71
- data/lib/tzinfo/definitions/America/Aruba.rb +18 -12
- data/lib/tzinfo/definitions/America/Asuncion.rb +172 -164
- data/lib/tzinfo/definitions/America/Atka.rb +11 -10
- data/lib/tzinfo/definitions/America/Bahia.rb +75 -69
- data/lib/tzinfo/definitions/America/Barbados.rb +27 -20
- data/lib/tzinfo/definitions/America/Belem.rb +45 -39
- data/lib/tzinfo/definitions/America/Belize.rb +72 -65
- data/lib/tzinfo/definitions/America/Boa_Vista.rb +49 -43
- data/lib/tzinfo/definitions/America/Bogota.rb +21 -14
- data/lib/tzinfo/definitions/America/Boise.rb +197 -187
- data/lib/tzinfo/definitions/America/Buenos_Aires.rb +11 -10
- data/lib/tzinfo/definitions/America/Cambridge_Bay.rb +175 -163
- data/lib/tzinfo/definitions/America/Campo_Grande.rb +169 -163
- data/lib/tzinfo/definitions/America/Cancun.rb +131 -123
- data/lib/tzinfo/definitions/America/Caracas.rb +20 -13
- data/lib/tzinfo/definitions/America/Catamarca.rb +11 -10
- data/lib/tzinfo/definitions/America/Cayenne.rb +18 -12
- data/lib/tzinfo/definitions/America/Cayman.rb +18 -12
- data/lib/tzinfo/definitions/America/Chicago.rb +281 -272
- data/lib/tzinfo/definitions/America/Chihuahua.rb +134 -126
- data/lib/tzinfo/definitions/America/Coral_Harbour.rb +26 -18
- data/lib/tzinfo/definitions/America/Cordoba.rb +11 -10
- data/lib/tzinfo/definitions/America/Costa_Rica.rb +27 -20
- data/lib/tzinfo/definitions/America/Cuiaba.rb +167 -161
- data/lib/tzinfo/definitions/America/Curacao.rb +18 -12
- data/lib/tzinfo/definitions/America/Danmarkshavn.rb +51 -44
- data/lib/tzinfo/definitions/America/Dawson.rb +174 -163
- data/lib/tzinfo/definitions/America/Dawson_Creek.rb +77 -68
- data/lib/tzinfo/definitions/America/Denver.rb +202 -194
- data/lib/tzinfo/definitions/America/Detroit.rb +184 -175
- data/lib/tzinfo/definitions/America/Dominica.rb +16 -11
- data/lib/tzinfo/definitions/America/Edmonton.rb +198 -190
- data/lib/tzinfo/definitions/America/Eirunepe.rb +47 -41
- data/lib/tzinfo/definitions/America/El_Salvador.rb +21 -15
- data/lib/tzinfo/definitions/America/Ensenada.rb +11 -10
- data/lib/tzinfo/definitions/America/Fort_Wayne.rb +11 -10
- data/lib/tzinfo/definitions/America/Fortaleza.rb +55 -49
- data/lib/tzinfo/definitions/America/Glace_Bay.rb +184 -176
- data/lib/tzinfo/definitions/America/Godthab.rb +159 -153
- data/lib/tzinfo/definitions/America/Goose_Bay.rb +253 -240
- data/lib/tzinfo/definitions/America/Grand_Turk.rb +163 -156
- data/lib/tzinfo/definitions/America/Grenada.rb +16 -11
- data/lib/tzinfo/definitions/America/Guadeloupe.rb +16 -11
- data/lib/tzinfo/definitions/America/Guatemala.rb +25 -19
- data/lib/tzinfo/definitions/America/Guayaquil.rb +18 -12
- data/lib/tzinfo/definitions/America/Guyana.rb +22 -14
- data/lib/tzinfo/definitions/America/Halifax.rb +272 -264
- data/lib/tzinfo/definitions/America/Havana.rb +199 -192
- data/lib/tzinfo/definitions/America/Hermosillo.rb +33 -25
- data/lib/tzinfo/definitions/America/Indiana/Indianapolis.rb +147 -137
- data/lib/tzinfo/definitions/America/Indiana/Knox.rb +201 -192
- data/lib/tzinfo/definitions/America/Indiana/Marengo.rb +151 -141
- data/lib/tzinfo/definitions/America/Indiana/Petersburg.rb +163 -154
- data/lib/tzinfo/definitions/America/Indiana/Vevay.rb +129 -119
- data/lib/tzinfo/definitions/America/Indiana/Vincennes.rb +149 -139
- data/lib/tzinfo/definitions/America/Indianapolis.rb +11 -10
- data/lib/tzinfo/definitions/America/Inuvik.rb +174 -163
- data/lib/tzinfo/definitions/America/Iqaluit.rb +173 -162
- data/lib/tzinfo/definitions/America/Jamaica.rb +39 -32
- data/lib/tzinfo/definitions/America/Jujuy.rb +11 -10
- data/lib/tzinfo/definitions/America/Juneau.rb +192 -180
- data/lib/tzinfo/definitions/America/Kentucky/Louisville.rb +226 -216
- data/lib/tzinfo/definitions/America/Kentucky/Monticello.rb +196 -186
- data/lib/tzinfo/definitions/America/Knox_IN.rb +11 -10
- data/lib/tzinfo/definitions/America/La_Paz.rb +20 -13
- data/lib/tzinfo/definitions/America/Lima.rb +33 -26
- data/lib/tzinfo/definitions/America/Los_Angeles.rb +230 -222
- data/lib/tzinfo/definitions/America/Louisville.rb +11 -10
- data/lib/tzinfo/definitions/America/Maceio.rb +57 -51
- data/lib/tzinfo/definitions/America/Managua.rb +34 -26
- data/lib/tzinfo/definitions/America/Manaus.rb +47 -41
- data/lib/tzinfo/definitions/America/Martinique.rb +21 -14
- data/lib/tzinfo/definitions/America/Mazatlan.rb +137 -129
- data/lib/tzinfo/definitions/America/Mendoza.rb +11 -10
- data/lib/tzinfo/definitions/America/Menominee.rb +188 -179
- data/lib/tzinfo/definitions/America/Merida.rb +130 -123
- data/lib/tzinfo/definitions/America/Mexico_City.rb +142 -134
- data/lib/tzinfo/definitions/America/Miquelon.rb +147 -140
- data/lib/tzinfo/definitions/America/Moncton.rb +252 -243
- data/lib/tzinfo/definitions/America/Monterrey.rb +129 -123
- data/lib/tzinfo/definitions/America/Montevideo.rb +89 -79
- data/lib/tzinfo/definitions/America/Montreal.rb +277 -269
- data/lib/tzinfo/definitions/America/Montserrat.rb +16 -11
- data/lib/tzinfo/definitions/America/Nassau.rb +191 -185
- data/lib/tzinfo/definitions/America/New_York.rb +280 -272
- data/lib/tzinfo/definitions/America/Nipigon.rb +179 -171
- data/lib/tzinfo/definitions/America/Nome.rb +194 -181
- data/lib/tzinfo/definitions/America/Noronha.rb +55 -49
- data/lib/tzinfo/definitions/America/North_Dakota/Center.rb +198 -188
- data/lib/tzinfo/definitions/America/North_Dakota/New_Salem.rb +198 -188
- data/lib/tzinfo/definitions/America/Panama.rb +18 -12
- data/lib/tzinfo/definitions/America/Pangnirtung.rb +175 -162
- data/lib/tzinfo/definitions/America/Paramaribo.rb +24 -15
- data/lib/tzinfo/definitions/America/Phoenix.rb +28 -21
- data/lib/tzinfo/definitions/America/Port__m__au__m__Prince.rb +141 -134
- data/lib/tzinfo/definitions/America/Port_of_Spain.rb +16 -11
- data/lib/tzinfo/definitions/America/Porto_Acre.rb +11 -10
- data/lib/tzinfo/definitions/America/Porto_Velho.rb +45 -39
- data/lib/tzinfo/definitions/America/Puerto_Rico.rb +21 -14
- data/lib/tzinfo/definitions/America/Rainy_River.rb +179 -171
- data/lib/tzinfo/definitions/America/Rankin_Inlet.rb +172 -162
- data/lib/tzinfo/definitions/America/Recife.rb +55 -49
- data/lib/tzinfo/definitions/America/Regina.rb +72 -63
- data/lib/tzinfo/definitions/America/Rio_Branco.rb +45 -39
- data/lib/tzinfo/definitions/America/Rosario.rb +11 -10
- data/lib/tzinfo/definitions/America/Santiago.rb +202 -193
- data/lib/tzinfo/definitions/America/Santo_Domingo.rb +36 -27
- data/lib/tzinfo/definitions/America/Sao_Paulo.rb +169 -163
- data/lib/tzinfo/definitions/America/Scoresbysund.rb +161 -153
- data/lib/tzinfo/definitions/America/Shiprock.rb +11 -10
- data/lib/tzinfo/definitions/America/St_Johns.rb +286 -275
- data/lib/tzinfo/definitions/America/St_Kitts.rb +16 -11
- data/lib/tzinfo/definitions/America/St_Lucia.rb +18 -12
- data/lib/tzinfo/definitions/America/St_Thomas.rb +16 -11
- data/lib/tzinfo/definitions/America/St_Vincent.rb +18 -12
- data/lib/tzinfo/definitions/America/Swift_Current.rb +42 -33
- data/lib/tzinfo/definitions/America/Tegucigalpa.rb +23 -17
- data/lib/tzinfo/definitions/America/Thule.rb +137 -131
- data/lib/tzinfo/definitions/America/Thunder_Bay.rb +184 -175
- data/lib/tzinfo/definitions/America/Tijuana.rb +194 -185
- data/lib/tzinfo/definitions/America/Toronto.rb +277 -269
- data/lib/tzinfo/definitions/America/Tortola.rb +16 -11
- data/lib/tzinfo/definitions/America/Vancouver.rb +234 -226
- data/lib/tzinfo/definitions/America/Virgin.rb +11 -10
- data/lib/tzinfo/definitions/America/Whitehorse.rb +174 -163
- data/lib/tzinfo/definitions/America/Winnipeg.rb +230 -222
- data/lib/tzinfo/definitions/America/Yakutat.rb +191 -180
- data/lib/tzinfo/definitions/America/Yellowknife.rb +171 -162
- data/lib/tzinfo/definitions/Antarctica/Casey.rb +16 -11
- data/lib/tzinfo/definitions/Antarctica/Davis.rb +18 -13
- data/lib/tzinfo/definitions/Antarctica/DumontDUrville.rb +19 -13
- data/lib/tzinfo/definitions/Antarctica/Mawson.rb +16 -11
- data/lib/tzinfo/definitions/Antarctica/McMurdo.rb +169 -163
- data/lib/tzinfo/definitions/Antarctica/Palmer.rb +176 -166
- data/lib/tzinfo/definitions/Antarctica/Rothera.rb +16 -11
- data/lib/tzinfo/definitions/Antarctica/South_Pole.rb +11 -10
- data/lib/tzinfo/definitions/Antarctica/Syowa.rb +16 -11
- data/lib/tzinfo/definitions/Antarctica/Vostok.rb +16 -11
- data/lib/tzinfo/definitions/Arctic/Longyearbyen.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Aden.rb +16 -11
- data/lib/tzinfo/definitions/Asia/Almaty.rb +65 -58
- data/lib/tzinfo/definitions/Asia/Amman.rb +161 -155
- data/lib/tzinfo/definitions/Asia/Anadyr.rb +163 -153
- data/lib/tzinfo/definitions/Asia/Aqtau.rb +73 -60
- data/lib/tzinfo/definitions/Asia/Aqtobe.rb +69 -59
- data/lib/tzinfo/definitions/Asia/Ashgabat.rb +46 -36
- data/lib/tzinfo/definitions/Asia/Ashkhabad.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Baghdad.rb +157 -150
- data/lib/tzinfo/definitions/Asia/Bahrain.rb +18 -12
- data/lib/tzinfo/definitions/Asia/Baku.rb +159 -147
- data/lib/tzinfo/definitions/Asia/Bangkok.rb +18 -12
- data/lib/tzinfo/definitions/Asia/Beirut.rb +183 -177
- data/lib/tzinfo/definitions/Asia/Bishkek.rb +73 -62
- data/lib/tzinfo/definitions/Asia/Brunei.rb +18 -12
- data/lib/tzinfo/definitions/Asia/Calcutta.rb +23 -15
- data/lib/tzinfo/definitions/Asia/Choibalsan.rb +152 -144
- data/lib/tzinfo/definitions/Asia/Chongqing.rb +31 -24
- data/lib/tzinfo/definitions/Asia/Chungking.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Colombo.rb +28 -18
- data/lib/tzinfo/definitions/Asia/Dacca.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Damascus.rb +193 -187
- data/lib/tzinfo/definitions/Asia/Dhaka.rb +25 -16
- data/lib/tzinfo/definitions/Asia/Dili.rb +23 -15
- data/lib/tzinfo/definitions/Asia/Dubai.rb +16 -11
- data/lib/tzinfo/definitions/Asia/Dushanbe.rb +43 -34
- data/lib/tzinfo/definitions/Asia/Gaza.rb +189 -180
- data/lib/tzinfo/definitions/Asia/Harbin.rb +35 -27
- data/lib/tzinfo/definitions/Asia/Hong_Kong.rb +85 -79
- data/lib/tzinfo/definitions/Asia/Hovd.rb +151 -144
- data/lib/tzinfo/definitions/Asia/Irkutsk.rb +163 -154
- data/lib/tzinfo/definitions/Asia/Istanbul.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Jakarta.rb +28 -18
- data/lib/tzinfo/definitions/Asia/Jayapura.rb +19 -13
- data/lib/tzinfo/definitions/Asia/Jerusalem.rb +161 -153
- data/lib/tzinfo/definitions/Asia/Kabul.rb +18 -12
- data/lib/tzinfo/definitions/Asia/Kamchatka.rb +161 -153
- data/lib/tzinfo/definitions/Asia/Karachi.rb +26 -17
- data/lib/tzinfo/definitions/Asia/Kashgar.rb +33 -25
- data/lib/tzinfo/definitions/Asia/Katmandu.rb +18 -12
- data/lib/tzinfo/definitions/Asia/Krasnoyarsk.rb +161 -153
- data/lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb +29 -18
- data/lib/tzinfo/definitions/Asia/Kuching.rb +38 -29
- data/lib/tzinfo/definitions/Asia/Kuwait.rb +16 -11
- data/lib/tzinfo/definitions/Asia/Macao.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Macau.rb +59 -52
- data/lib/tzinfo/definitions/Asia/Magadan.rb +161 -153
- data/lib/tzinfo/definitions/Asia/Makassar.rb +21 -14
- data/lib/tzinfo/definitions/Asia/Manila.rb +28 -20
- data/lib/tzinfo/definitions/Asia/Muscat.rb +16 -11
- data/lib/tzinfo/definitions/Asia/Nicosia.rb +169 -163
- data/lib/tzinfo/definitions/Asia/Novosibirsk.rb +162 -154
- data/lib/tzinfo/definitions/Asia/Omsk.rb +161 -153
- data/lib/tzinfo/definitions/Asia/Oral.rb +72 -60
- data/lib/tzinfo/definitions/Asia/Phnom_Penh.rb +21 -14
- data/lib/tzinfo/definitions/Asia/Pontianak.rb +28 -18
- data/lib/tzinfo/definitions/Asia/Pyongyang.rb +23 -16
- data/lib/tzinfo/definitions/Asia/Qatar.rb +18 -12
- data/lib/tzinfo/definitions/Asia/Qyzylorda.rb +71 -60
- data/lib/tzinfo/definitions/Asia/Rangoon.rb +22 -14
- data/lib/tzinfo/definitions/Asia/Riyadh.rb +16 -11
- data/lib/tzinfo/definitions/Asia/Riyadh87.rb +590 -346
- data/lib/tzinfo/definitions/Asia/Riyadh88.rb +580 -347
- data/lib/tzinfo/definitions/Asia/Riyadh89.rb +580 -347
- data/lib/tzinfo/definitions/Asia/Saigon.rb +21 -14
- data/lib/tzinfo/definitions/Asia/Sakhalin.rb +164 -154
- data/lib/tzinfo/definitions/Asia/Samarkand.rb +45 -35
- data/lib/tzinfo/definitions/Asia/Seoul.rb +32 -23
- data/lib/tzinfo/definitions/Asia/Shanghai.rb +33 -27
- data/lib/tzinfo/definitions/Asia/Singapore.rb +31 -19
- data/lib/tzinfo/definitions/Asia/Taipei.rb +57 -51
- data/lib/tzinfo/definitions/Asia/Tashkent.rb +45 -35
- data/lib/tzinfo/definitions/Asia/Tbilisi.rb +76 -63
- data/lib/tzinfo/definitions/Asia/Tehran.rb +59 -50
- data/lib/tzinfo/definitions/Asia/Tel_Aviv.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Thimbu.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Thimphu.rb +18 -12
- data/lib/tzinfo/definitions/Asia/Tokyo.rb +28 -21
- data/lib/tzinfo/definitions/Asia/Ujung_Pandang.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Ulaanbaatar.rb +151 -144
- data/lib/tzinfo/definitions/Asia/Ulan_Bator.rb +11 -10
- data/lib/tzinfo/definitions/Asia/Urumqi.rb +31 -24
- data/lib/tzinfo/definitions/Asia/Vientiane.rb +21 -14
- data/lib/tzinfo/definitions/Asia/Vladivostok.rb +162 -153
- data/lib/tzinfo/definitions/Asia/Yakutsk.rb +161 -153
- data/lib/tzinfo/definitions/Asia/Yekaterinburg.rb +163 -153
- data/lib/tzinfo/definitions/Asia/Yerevan.rb +163 -151
- data/lib/tzinfo/definitions/Atlantic/Azores.rb +268 -257
- data/lib/tzinfo/definitions/Atlantic/Bermuda.rb +171 -165
- data/lib/tzinfo/definitions/Atlantic/Canary.rb +161 -154
- data/lib/tzinfo/definitions/Atlantic/Cape_Verde.rb +21 -14
- data/lib/tzinfo/definitions/Atlantic/Faeroe.rb +157 -151
- data/lib/tzinfo/definitions/Atlantic/Jan_Mayen.rb +11 -10
- data/lib/tzinfo/definitions/Atlantic/Madeira.rb +267 -257
- data/lib/tzinfo/definitions/Atlantic/Reykjavik.rb +83 -75
- data/lib/tzinfo/definitions/Atlantic/South_Georgia.rb +16 -11
- data/lib/tzinfo/definitions/Atlantic/St_Helena.rb +18 -12
- data/lib/tzinfo/definitions/Atlantic/Stanley.rb +168 -159
- data/lib/tzinfo/definitions/Australia/ACT.rb +11 -10
- data/lib/tzinfo/definitions/Australia/Adelaide.rb +185 -178
- data/lib/tzinfo/definitions/Australia/Brisbane.rb +33 -27
- data/lib/tzinfo/definitions/Australia/Broken_Hill.rb +187 -179
- data/lib/tzinfo/definitions/Australia/Canberra.rb +11 -10
- data/lib/tzinfo/definitions/Australia/Currie.rb +183 -177
- data/lib/tzinfo/definitions/Australia/Darwin.rb +27 -20
- data/lib/tzinfo/definitions/Australia/Hobart.rb +191 -185
- data/lib/tzinfo/definitions/Australia/LHI.rb +11 -10
- data/lib/tzinfo/definitions/Australia/Lindeman.rb +37 -31
- data/lib/tzinfo/definitions/Australia/Lord_Howe.rb +158 -150
- data/lib/tzinfo/definitions/Australia/Melbourne.rb +183 -177
- data/lib/tzinfo/definitions/Australia/NSW.rb +11 -10
- data/lib/tzinfo/definitions/Australia/North.rb +11 -10
- data/lib/tzinfo/definitions/Australia/Perth.rb +29 -23
- data/lib/tzinfo/definitions/Australia/Queensland.rb +11 -10
- data/lib/tzinfo/definitions/Australia/South.rb +11 -10
- data/lib/tzinfo/definitions/Australia/Sydney.rb +183 -177
- data/lib/tzinfo/definitions/Australia/Tasmania.rb +11 -10
- data/lib/tzinfo/definitions/Australia/Victoria.rb +11 -10
- data/lib/tzinfo/definitions/Australia/West.rb +11 -10
- data/lib/tzinfo/definitions/Australia/Yancowinna.rb +11 -10
- data/lib/tzinfo/definitions/Brazil/Acre.rb +11 -10
- data/lib/tzinfo/definitions/Brazil/DeNoronha.rb +11 -10
- data/lib/tzinfo/definitions/Brazil/East.rb +11 -10
- data/lib/tzinfo/definitions/Brazil/West.rb +11 -10
- data/lib/tzinfo/definitions/CET.rb +173 -168
- data/lib/tzinfo/definitions/CST6CDT.rb +190 -183
- data/lib/tzinfo/definitions/Canada/Atlantic.rb +11 -10
- data/lib/tzinfo/definitions/Canada/Central.rb +11 -10
- data/lib/tzinfo/definitions/Canada/East__m__Saskatchewan.rb +11 -10
- data/lib/tzinfo/definitions/Canada/Eastern.rb +11 -10
- data/lib/tzinfo/definitions/Canada/Mountain.rb +11 -10
- data/lib/tzinfo/definitions/Canada/Newfoundland.rb +11 -10
- data/lib/tzinfo/definitions/Canada/Pacific.rb +11 -10
- data/lib/tzinfo/definitions/Canada/Saskatchewan.rb +11 -10
- data/lib/tzinfo/definitions/Canada/Yukon.rb +11 -10
- data/lib/tzinfo/definitions/Chile/Continental.rb +11 -10
- data/lib/tzinfo/definitions/Chile/EasterIsland.rb +11 -10
- data/lib/tzinfo/definitions/Cuba.rb +9 -8
- data/lib/tzinfo/definitions/EET.rb +161 -156
- data/lib/tzinfo/definitions/EST.rb +12 -8
- data/lib/tzinfo/definitions/EST5EDT.rb +190 -183
- data/lib/tzinfo/definitions/Egypt.rb +9 -8
- data/lib/tzinfo/definitions/Eire.rb +9 -8
- data/lib/tzinfo/definitions/Etc/GMT.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT0.rb +11 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__0.rb +11 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__1.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__10.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__11.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__12.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__13.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__14.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__2.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__3.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__4.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__5.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__6.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__7.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__8.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__m__9.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__0.rb +11 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__1.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__10.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__11.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__12.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__2.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__3.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__4.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__5.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__6.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__7.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__8.rb +14 -10
- data/lib/tzinfo/definitions/Etc/GMT__p__9.rb +14 -10
- data/lib/tzinfo/definitions/Etc/Greenwich.rb +11 -10
- data/lib/tzinfo/definitions/Etc/UCT.rb +14 -10
- data/lib/tzinfo/definitions/Etc/UTC.rb +14 -10
- data/lib/tzinfo/definitions/Etc/Universal.rb +11 -10
- data/lib/tzinfo/definitions/Etc/Zulu.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Amsterdam.rb +226 -216
- data/lib/tzinfo/definitions/Europe/Andorra.rb +151 -144
- data/lib/tzinfo/definitions/Europe/Athens.rb +183 -174
- data/lib/tzinfo/definitions/Europe/Belfast.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Belgrade.rb +161 -155
- data/lib/tzinfo/definitions/Europe/Berlin.rb +186 -179
- data/lib/tzinfo/definitions/Europe/Bratislava.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Brussels.rb +230 -221
- data/lib/tzinfo/definitions/Europe/Bucharest.rb +179 -172
- data/lib/tzinfo/definitions/Europe/Budapest.rb +195 -189
- data/lib/tzinfo/definitions/Europe/Chisinau.rb +187 -175
- data/lib/tzinfo/definitions/Europe/Copenhagen.rb +177 -170
- data/lib/tzinfo/definitions/Europe/Dublin.rb +274 -263
- data/lib/tzinfo/definitions/Europe/Gibraltar.rb +243 -234
- data/lib/tzinfo/definitions/Europe/Helsinki.rb +161 -154
- data/lib/tzinfo/definitions/Europe/Istanbul.rb +216 -207
- data/lib/tzinfo/definitions/Europe/Kaliningrad.rb +179 -167
- data/lib/tzinfo/definitions/Europe/Kiev.rb +166 -155
- data/lib/tzinfo/definitions/Europe/Lisbon.rb +266 -257
- data/lib/tzinfo/definitions/Europe/Ljubljana.rb +11 -10
- data/lib/tzinfo/definitions/Europe/London.rb +286 -277
- data/lib/tzinfo/definitions/Europe/Luxembourg.rb +229 -219
- data/lib/tzinfo/definitions/Europe/Madrid.rb +209 -200
- data/lib/tzinfo/definitions/Europe/Malta.rb +211 -205
- data/lib/tzinfo/definitions/Europe/Mariehamn.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Minsk.rb +168 -157
- data/lib/tzinfo/definitions/Europe/Monaco.rb +231 -221
- data/lib/tzinfo/definitions/Europe/Moscow.rb +179 -166
- data/lib/tzinfo/definitions/Europe/Nicosia.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Oslo.rb +183 -177
- data/lib/tzinfo/definitions/Europe/Paris.rb +230 -220
- data/lib/tzinfo/definitions/Europe/Prague.rb +185 -178
- data/lib/tzinfo/definitions/Europe/Riga.rb +174 -162
- data/lib/tzinfo/definitions/Europe/Rome.rb +213 -206
- data/lib/tzinfo/definitions/Europe/Samara.rb +164 -153
- data/lib/tzinfo/definitions/Europe/San_Marino.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Sarajevo.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Simferopol.rb +168 -157
- data/lib/tzinfo/definitions/Europe/Skopje.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Sofia.rb +171 -162
- data/lib/tzinfo/definitions/Europe/Stockholm.rb +163 -156
- data/lib/tzinfo/definitions/Europe/Tallinn.rb +170 -159
- data/lib/tzinfo/definitions/Europe/Tirane.rb +175 -169
- data/lib/tzinfo/definitions/Europe/Tiraspol.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Uzhgorod.rb +166 -156
- data/lib/tzinfo/definitions/Europe/Vaduz.rb +157 -151
- data/lib/tzinfo/definitions/Europe/Vatican.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Vienna.rb +181 -175
- data/lib/tzinfo/definitions/Europe/Vilnius.rb +168 -156
- data/lib/tzinfo/definitions/Europe/Warsaw.rb +210 -201
- data/lib/tzinfo/definitions/Europe/Zagreb.rb +11 -10
- data/lib/tzinfo/definitions/Europe/Zaporozhye.rb +169 -158
- data/lib/tzinfo/definitions/Europe/Zurich.rb +165 -158
- data/lib/tzinfo/definitions/GB.rb +9 -8
- data/lib/tzinfo/definitions/GB__m__Eire.rb +9 -8
- data/lib/tzinfo/definitions/GMT.rb +9 -8
- data/lib/tzinfo/definitions/GMT0.rb +9 -8
- data/lib/tzinfo/definitions/GMT__m__0.rb +9 -8
- data/lib/tzinfo/definitions/GMT__p__0.rb +9 -8
- data/lib/tzinfo/definitions/Greenwich.rb +9 -8
- data/lib/tzinfo/definitions/HST.rb +12 -8
- data/lib/tzinfo/definitions/Hongkong.rb +9 -8
- data/lib/tzinfo/definitions/Iceland.rb +9 -8
- data/lib/tzinfo/definitions/Indian/Antananarivo.rb +19 -13
- data/lib/tzinfo/definitions/Indian/Chagos.rb +18 -12
- data/lib/tzinfo/definitions/Indian/Christmas.rb +16 -11
- data/lib/tzinfo/definitions/Indian/Cocos.rb +16 -11
- data/lib/tzinfo/definitions/Indian/Comoro.rb +16 -11
- data/lib/tzinfo/definitions/Indian/Kerguelen.rb +16 -11
- data/lib/tzinfo/definitions/Indian/Mahe.rb +16 -11
- data/lib/tzinfo/definitions/Indian/Maldives.rb +18 -12
- data/lib/tzinfo/definitions/Indian/Mauritius.rb +16 -11
- data/lib/tzinfo/definitions/Indian/Mayotte.rb +16 -11
- data/lib/tzinfo/definitions/Indian/Reunion.rb +16 -11
- data/lib/tzinfo/definitions/Iran.rb +9 -8
- data/lib/tzinfo/definitions/Israel.rb +9 -8
- data/lib/tzinfo/definitions/Jamaica.rb +9 -8
- data/lib/tzinfo/definitions/Japan.rb +9 -8
- data/lib/tzinfo/definitions/Kwajalein.rb +9 -8
- data/lib/tzinfo/definitions/Libya.rb +9 -8
- data/lib/tzinfo/definitions/MET.rb +173 -168
- data/lib/tzinfo/definitions/MST.rb +12 -8
- data/lib/tzinfo/definitions/MST7MDT.rb +190 -183
- data/lib/tzinfo/definitions/Mexico/BajaNorte.rb +11 -10
- data/lib/tzinfo/definitions/Mexico/BajaSur.rb +11 -10
- data/lib/tzinfo/definitions/Mexico/General.rb +11 -10
- data/lib/tzinfo/definitions/Mideast/Riyadh87.rb +11 -10
- data/lib/tzinfo/definitions/Mideast/Riyadh88.rb +11 -10
- data/lib/tzinfo/definitions/Mideast/Riyadh89.rb +11 -10
- data/lib/tzinfo/definitions/NZ.rb +9 -8
- data/lib/tzinfo/definitions/NZ__m__CHAT.rb +9 -8
- data/lib/tzinfo/definitions/Navajo.rb +9 -8
- data/lib/tzinfo/definitions/PRC.rb +9 -8
- data/lib/tzinfo/definitions/PST8PDT.rb +190 -183
- data/lib/tzinfo/definitions/Pacific/Apia.rb +20 -13
- data/lib/tzinfo/definitions/Pacific/Auckland.rb +200 -190
- data/lib/tzinfo/definitions/Pacific/Chatham.rb +169 -163
- data/lib/tzinfo/definitions/Pacific/Easter.rb +189 -180
- data/lib/tzinfo/definitions/Pacific/Efate.rb +37 -31
- data/lib/tzinfo/definitions/Pacific/Enderbury.rb +20 -13
- data/lib/tzinfo/definitions/Pacific/Fakaofo.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Fiji.rb +21 -15
- data/lib/tzinfo/definitions/Pacific/Funafuti.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Galapagos.rb +18 -12
- data/lib/tzinfo/definitions/Pacific/Gambier.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Guadalcanal.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Guam.rb +20 -13
- data/lib/tzinfo/definitions/Pacific/Honolulu.rb +26 -17
- data/lib/tzinfo/definitions/Pacific/Johnston.rb +14 -10
- data/lib/tzinfo/definitions/Pacific/Kiritimati.rb +20 -13
- data/lib/tzinfo/definitions/Pacific/Kosrae.rb +19 -13
- data/lib/tzinfo/definitions/Pacific/Kwajalein.rb +20 -13
- data/lib/tzinfo/definitions/Pacific/Majuro.rb +18 -12
- data/lib/tzinfo/definitions/Pacific/Marquesas.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Midway.rb +23 -15
- data/lib/tzinfo/definitions/Pacific/Nauru.rb +21 -14
- data/lib/tzinfo/definitions/Pacific/Niue.rb +20 -13
- data/lib/tzinfo/definitions/Pacific/Norfolk.rb +18 -12
- data/lib/tzinfo/definitions/Pacific/Noumea.rb +23 -17
- data/lib/tzinfo/definitions/Pacific/Pago_Pago.rb +24 -15
- data/lib/tzinfo/definitions/Pacific/Palau.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Pitcairn.rb +18 -12
- data/lib/tzinfo/definitions/Pacific/Ponape.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Port_Moresby.rb +18 -12
- data/lib/tzinfo/definitions/Pacific/Rarotonga.rb +44 -37
- data/lib/tzinfo/definitions/Pacific/Saipan.rb +22 -14
- data/lib/tzinfo/definitions/Pacific/Samoa.rb +11 -10
- data/lib/tzinfo/definitions/Pacific/Tahiti.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Tarawa.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Tongatapu.rb +25 -18
- data/lib/tzinfo/definitions/Pacific/Truk.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Wake.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Wallis.rb +16 -11
- data/lib/tzinfo/definitions/Pacific/Yap.rb +11 -10
- data/lib/tzinfo/definitions/Poland.rb +9 -8
- data/lib/tzinfo/definitions/Portugal.rb +9 -8
- data/lib/tzinfo/definitions/ROC.rb +9 -8
- data/lib/tzinfo/definitions/ROK.rb +9 -8
- data/lib/tzinfo/definitions/Singapore.rb +9 -8
- data/lib/tzinfo/definitions/Turkey.rb +9 -8
- data/lib/tzinfo/definitions/UCT.rb +9 -8
- data/lib/tzinfo/definitions/US/Alaska.rb +11 -10
- data/lib/tzinfo/definitions/US/Aleutian.rb +11 -10
- data/lib/tzinfo/definitions/US/Arizona.rb +11 -10
- data/lib/tzinfo/definitions/US/Central.rb +11 -10
- data/lib/tzinfo/definitions/US/East__m__Indiana.rb +11 -10
- data/lib/tzinfo/definitions/US/Eastern.rb +11 -10
- data/lib/tzinfo/definitions/US/Hawaii.rb +11 -10
- data/lib/tzinfo/definitions/US/Indiana__m__Starke.rb +11 -10
- data/lib/tzinfo/definitions/US/Michigan.rb +11 -10
- data/lib/tzinfo/definitions/US/Mountain.rb +11 -10
- data/lib/tzinfo/definitions/US/Pacific.rb +11 -10
- data/lib/tzinfo/definitions/US/Pacific__m__New.rb +11 -10
- data/lib/tzinfo/definitions/US/Samoa.rb +11 -10
- data/lib/tzinfo/definitions/UTC.rb +9 -8
- data/lib/tzinfo/definitions/Universal.rb +9 -8
- data/lib/tzinfo/definitions/WET.rb +161 -156
- data/lib/tzinfo/definitions/W__m__SU.rb +9 -8
- data/lib/tzinfo/definitions/Zulu.rb +9 -8
- data/lib/tzinfo/indexes/countries.rb +875 -0
- data/lib/tzinfo/indexes/timezones.rb +554 -0
- data/lib/tzinfo/info_timezone.rb +52 -0
- data/lib/tzinfo/linked_timezone.rb +51 -0
- data/lib/tzinfo/linked_timezone_info.rb +44 -0
- data/lib/tzinfo/time_or_datetime.rb +33 -22
- data/lib/tzinfo/timezone.rb +162 -112
- data/lib/tzinfo/timezone_definition.rb +56 -0
- data/lib/tzinfo/timezone_index_definition.rb +72 -0
- data/lib/tzinfo/timezone_info.rb +40 -0
- data/lib/tzinfo/timezone_offset_info.rb +94 -0
- data/lib/tzinfo/timezone_period.rb +110 -53
- data/lib/tzinfo/timezone_proxy.rb +85 -0
- data/lib/tzinfo/timezone_transition_info.rb +127 -0
- data/lib/tzinfo/tzdataparser.rb +261 -203
- data/test/tc_country.rb +63 -38
- data/test/tc_country_index_definition.rb +71 -0
- data/test/tc_country_info.rb +72 -0
- data/test/tc_country_timezone.rb +121 -0
- data/test/tc_data_timezone.rb +69 -0
- data/test/tc_data_timezone_info.rb +282 -0
- data/test/tc_info_timezone.rb +37 -0
- data/test/tc_linked_timezone.rb +97 -0
- data/test/tc_linked_timezone_info.rb +18 -0
- data/test/tc_time_or_datetime.rb +30 -0
- data/test/tc_timezone.rb +536 -319
- data/test/tc_timezone_definition.rb +115 -0
- data/test/tc_timezone_index_definition.rb +75 -0
- data/test/tc_timezone_info.rb +13 -0
- data/test/tc_timezone_offset_info.rb +116 -0
- data/test/tc_timezone_period.rb +298 -78
- data/test/tc_timezone_proxy.rb +23 -13
- data/test/tc_timezone_transition_info.rb +194 -0
- metadata +38 -249
- data/lib/tzinfo/countries/AD.rb +0 -12
- data/lib/tzinfo/countries/AE.rb +0 -12
- data/lib/tzinfo/countries/AF.rb +0 -12
- data/lib/tzinfo/countries/AG.rb +0 -12
- data/lib/tzinfo/countries/AI.rb +0 -12
- data/lib/tzinfo/countries/AL.rb +0 -12
- data/lib/tzinfo/countries/AM.rb +0 -12
- data/lib/tzinfo/countries/AN.rb +0 -12
- data/lib/tzinfo/countries/AO.rb +0 -12
- data/lib/tzinfo/countries/AQ.rb +0 -21
- data/lib/tzinfo/countries/AR.rb +0 -21
- data/lib/tzinfo/countries/AS.rb +0 -12
- data/lib/tzinfo/countries/AT.rb +0 -12
- data/lib/tzinfo/countries/AU.rb +0 -22
- data/lib/tzinfo/countries/AW.rb +0 -12
- data/lib/tzinfo/countries/AX.rb +0 -12
- data/lib/tzinfo/countries/AZ.rb +0 -12
- data/lib/tzinfo/countries/BA.rb +0 -12
- data/lib/tzinfo/countries/BB.rb +0 -12
- data/lib/tzinfo/countries/BD.rb +0 -12
- data/lib/tzinfo/countries/BE.rb +0 -12
- data/lib/tzinfo/countries/BF.rb +0 -12
- data/lib/tzinfo/countries/BG.rb +0 -12
- data/lib/tzinfo/countries/BH.rb +0 -12
- data/lib/tzinfo/countries/BI.rb +0 -12
- data/lib/tzinfo/countries/BJ.rb +0 -12
- data/lib/tzinfo/countries/BM.rb +0 -12
- data/lib/tzinfo/countries/BN.rb +0 -12
- data/lib/tzinfo/countries/BO.rb +0 -12
- data/lib/tzinfo/countries/BR.rb +0 -26
- data/lib/tzinfo/countries/BS.rb +0 -12
- data/lib/tzinfo/countries/BT.rb +0 -12
- data/lib/tzinfo/countries/BV.rb +0 -11
- data/lib/tzinfo/countries/BW.rb +0 -12
- data/lib/tzinfo/countries/BY.rb +0 -12
- data/lib/tzinfo/countries/BZ.rb +0 -12
- data/lib/tzinfo/countries/CA.rb +0 -36
- data/lib/tzinfo/countries/CC.rb +0 -12
- data/lib/tzinfo/countries/CD.rb +0 -13
- data/lib/tzinfo/countries/CF.rb +0 -12
- data/lib/tzinfo/countries/CG.rb +0 -12
- data/lib/tzinfo/countries/CH.rb +0 -12
- data/lib/tzinfo/countries/CI.rb +0 -12
- data/lib/tzinfo/countries/CK.rb +0 -12
- data/lib/tzinfo/countries/CL.rb +0 -13
- data/lib/tzinfo/countries/CM.rb +0 -12
- data/lib/tzinfo/countries/CN.rb +0 -16
- data/lib/tzinfo/countries/CO.rb +0 -12
- data/lib/tzinfo/countries/CR.rb +0 -12
- data/lib/tzinfo/countries/CS.rb +0 -12
- data/lib/tzinfo/countries/CU.rb +0 -12
- data/lib/tzinfo/countries/CV.rb +0 -12
- data/lib/tzinfo/countries/CX.rb +0 -12
- data/lib/tzinfo/countries/CY.rb +0 -12
- data/lib/tzinfo/countries/CZ.rb +0 -12
- data/lib/tzinfo/countries/DE.rb +0 -12
- data/lib/tzinfo/countries/DJ.rb +0 -12
- data/lib/tzinfo/countries/DK.rb +0 -12
- data/lib/tzinfo/countries/DM.rb +0 -12
- data/lib/tzinfo/countries/DO.rb +0 -12
- data/lib/tzinfo/countries/DZ.rb +0 -12
- data/lib/tzinfo/countries/EC.rb +0 -13
- data/lib/tzinfo/countries/EE.rb +0 -12
- data/lib/tzinfo/countries/EG.rb +0 -12
- data/lib/tzinfo/countries/EH.rb +0 -12
- data/lib/tzinfo/countries/ER.rb +0 -12
- data/lib/tzinfo/countries/ES.rb +0 -14
- data/lib/tzinfo/countries/ET.rb +0 -12
- data/lib/tzinfo/countries/FI.rb +0 -12
- data/lib/tzinfo/countries/FJ.rb +0 -12
- data/lib/tzinfo/countries/FK.rb +0 -12
- data/lib/tzinfo/countries/FM.rb +0 -14
- data/lib/tzinfo/countries/FO.rb +0 -12
- data/lib/tzinfo/countries/FR.rb +0 -12
- data/lib/tzinfo/countries/GA.rb +0 -12
- data/lib/tzinfo/countries/GB.rb +0 -12
- data/lib/tzinfo/countries/GD.rb +0 -12
- data/lib/tzinfo/countries/GE.rb +0 -12
- data/lib/tzinfo/countries/GF.rb +0 -12
- data/lib/tzinfo/countries/GH.rb +0 -12
- data/lib/tzinfo/countries/GI.rb +0 -12
- data/lib/tzinfo/countries/GL.rb +0 -15
- data/lib/tzinfo/countries/GM.rb +0 -12
- data/lib/tzinfo/countries/GN.rb +0 -12
- data/lib/tzinfo/countries/GP.rb +0 -12
- data/lib/tzinfo/countries/GQ.rb +0 -12
- data/lib/tzinfo/countries/GR.rb +0 -12
- data/lib/tzinfo/countries/GS.rb +0 -12
- data/lib/tzinfo/countries/GT.rb +0 -12
- data/lib/tzinfo/countries/GU.rb +0 -12
- data/lib/tzinfo/countries/GW.rb +0 -12
- data/lib/tzinfo/countries/GY.rb +0 -12
- data/lib/tzinfo/countries/HK.rb +0 -12
- data/lib/tzinfo/countries/HM.rb +0 -11
- data/lib/tzinfo/countries/HN.rb +0 -12
- data/lib/tzinfo/countries/HR.rb +0 -12
- data/lib/tzinfo/countries/HT.rb +0 -12
- data/lib/tzinfo/countries/HU.rb +0 -12
- data/lib/tzinfo/countries/ID.rb +0 -15
- data/lib/tzinfo/countries/IE.rb +0 -12
- data/lib/tzinfo/countries/IL.rb +0 -12
- data/lib/tzinfo/countries/IN.rb +0 -12
- data/lib/tzinfo/countries/IO.rb +0 -12
- data/lib/tzinfo/countries/IQ.rb +0 -12
- data/lib/tzinfo/countries/IR.rb +0 -12
- data/lib/tzinfo/countries/IS.rb +0 -12
- data/lib/tzinfo/countries/IT.rb +0 -12
- data/lib/tzinfo/countries/Index.rb +0 -253
- data/lib/tzinfo/countries/JM.rb +0 -12
- data/lib/tzinfo/countries/JO.rb +0 -12
- data/lib/tzinfo/countries/JP.rb +0 -12
- data/lib/tzinfo/countries/KE.rb +0 -12
- data/lib/tzinfo/countries/KG.rb +0 -12
- data/lib/tzinfo/countries/KH.rb +0 -12
- data/lib/tzinfo/countries/KI.rb +0 -14
- data/lib/tzinfo/countries/KM.rb +0 -12
- data/lib/tzinfo/countries/KN.rb +0 -12
- data/lib/tzinfo/countries/KP.rb +0 -12
- data/lib/tzinfo/countries/KR.rb +0 -12
- data/lib/tzinfo/countries/KW.rb +0 -12
- data/lib/tzinfo/countries/KY.rb +0 -12
- data/lib/tzinfo/countries/KZ.rb +0 -16
- data/lib/tzinfo/countries/LA.rb +0 -12
- data/lib/tzinfo/countries/LB.rb +0 -12
- data/lib/tzinfo/countries/LC.rb +0 -12
- data/lib/tzinfo/countries/LI.rb +0 -12
- data/lib/tzinfo/countries/LK.rb +0 -12
- data/lib/tzinfo/countries/LR.rb +0 -12
- data/lib/tzinfo/countries/LS.rb +0 -12
- data/lib/tzinfo/countries/LT.rb +0 -12
- data/lib/tzinfo/countries/LU.rb +0 -12
- data/lib/tzinfo/countries/LV.rb +0 -12
- data/lib/tzinfo/countries/LY.rb +0 -12
- data/lib/tzinfo/countries/MA.rb +0 -12
- data/lib/tzinfo/countries/MC.rb +0 -12
- data/lib/tzinfo/countries/MD.rb +0 -12
- data/lib/tzinfo/countries/MG.rb +0 -12
- data/lib/tzinfo/countries/MH.rb +0 -13
- data/lib/tzinfo/countries/MK.rb +0 -12
- data/lib/tzinfo/countries/ML.rb +0 -12
- data/lib/tzinfo/countries/MM.rb +0 -12
- data/lib/tzinfo/countries/MN.rb +0 -14
- data/lib/tzinfo/countries/MO.rb +0 -12
- data/lib/tzinfo/countries/MP.rb +0 -12
- data/lib/tzinfo/countries/MQ.rb +0 -12
- data/lib/tzinfo/countries/MR.rb +0 -12
- data/lib/tzinfo/countries/MS.rb +0 -12
- data/lib/tzinfo/countries/MT.rb +0 -12
- data/lib/tzinfo/countries/MU.rb +0 -12
- data/lib/tzinfo/countries/MV.rb +0 -12
- data/lib/tzinfo/countries/MW.rb +0 -12
- data/lib/tzinfo/countries/MX.rb +0 -19
- data/lib/tzinfo/countries/MY.rb +0 -13
- data/lib/tzinfo/countries/MZ.rb +0 -12
- data/lib/tzinfo/countries/NA.rb +0 -12
- data/lib/tzinfo/countries/NC.rb +0 -12
- data/lib/tzinfo/countries/NE.rb +0 -12
- data/lib/tzinfo/countries/NF.rb +0 -12
- data/lib/tzinfo/countries/NG.rb +0 -12
- data/lib/tzinfo/countries/NI.rb +0 -12
- data/lib/tzinfo/countries/NL.rb +0 -12
- data/lib/tzinfo/countries/NO.rb +0 -12
- data/lib/tzinfo/countries/NP.rb +0 -12
- data/lib/tzinfo/countries/NR.rb +0 -12
- data/lib/tzinfo/countries/NU.rb +0 -12
- data/lib/tzinfo/countries/NZ.rb +0 -13
- data/lib/tzinfo/countries/OM.rb +0 -12
- data/lib/tzinfo/countries/PA.rb +0 -12
- data/lib/tzinfo/countries/PE.rb +0 -12
- data/lib/tzinfo/countries/PF.rb +0 -14
- data/lib/tzinfo/countries/PG.rb +0 -12
- data/lib/tzinfo/countries/PH.rb +0 -12
- data/lib/tzinfo/countries/PK.rb +0 -12
- data/lib/tzinfo/countries/PL.rb +0 -12
- data/lib/tzinfo/countries/PM.rb +0 -12
- data/lib/tzinfo/countries/PN.rb +0 -12
- data/lib/tzinfo/countries/PR.rb +0 -12
- data/lib/tzinfo/countries/PS.rb +0 -12
- data/lib/tzinfo/countries/PT.rb +0 -14
- data/lib/tzinfo/countries/PW.rb +0 -12
- data/lib/tzinfo/countries/PY.rb +0 -12
- data/lib/tzinfo/countries/QA.rb +0 -12
- data/lib/tzinfo/countries/RE.rb +0 -12
- data/lib/tzinfo/countries/RO.rb +0 -12
- data/lib/tzinfo/countries/RU.rb +0 -25
- data/lib/tzinfo/countries/RW.rb +0 -12
- data/lib/tzinfo/countries/SA.rb +0 -12
- data/lib/tzinfo/countries/SB.rb +0 -12
- data/lib/tzinfo/countries/SC.rb +0 -12
- data/lib/tzinfo/countries/SD.rb +0 -12
- data/lib/tzinfo/countries/SE.rb +0 -12
- data/lib/tzinfo/countries/SG.rb +0 -12
- data/lib/tzinfo/countries/SH.rb +0 -12
- data/lib/tzinfo/countries/SI.rb +0 -12
- data/lib/tzinfo/countries/SJ.rb +0 -13
- data/lib/tzinfo/countries/SK.rb +0 -12
- data/lib/tzinfo/countries/SL.rb +0 -12
- data/lib/tzinfo/countries/SM.rb +0 -12
- data/lib/tzinfo/countries/SN.rb +0 -12
- data/lib/tzinfo/countries/SO.rb +0 -12
- data/lib/tzinfo/countries/SR.rb +0 -12
- data/lib/tzinfo/countries/ST.rb +0 -12
- data/lib/tzinfo/countries/SV.rb +0 -12
- data/lib/tzinfo/countries/SY.rb +0 -12
- data/lib/tzinfo/countries/SZ.rb +0 -12
- data/lib/tzinfo/countries/TC.rb +0 -12
- data/lib/tzinfo/countries/TD.rb +0 -12
- data/lib/tzinfo/countries/TF.rb +0 -12
- data/lib/tzinfo/countries/TG.rb +0 -12
- data/lib/tzinfo/countries/TH.rb +0 -12
- data/lib/tzinfo/countries/TJ.rb +0 -12
- data/lib/tzinfo/countries/TK.rb +0 -12
- data/lib/tzinfo/countries/TL.rb +0 -12
- data/lib/tzinfo/countries/TM.rb +0 -12
- data/lib/tzinfo/countries/TN.rb +0 -12
- data/lib/tzinfo/countries/TO.rb +0 -12
- data/lib/tzinfo/countries/TR.rb +0 -12
- data/lib/tzinfo/countries/TT.rb +0 -12
- data/lib/tzinfo/countries/TV.rb +0 -12
- data/lib/tzinfo/countries/TW.rb +0 -12
- data/lib/tzinfo/countries/TZ.rb +0 -12
- data/lib/tzinfo/countries/UA.rb +0 -15
- data/lib/tzinfo/countries/UG.rb +0 -12
- data/lib/tzinfo/countries/UM.rb +0 -14
- data/lib/tzinfo/countries/US.rb +0 -36
- data/lib/tzinfo/countries/UY.rb +0 -12
- data/lib/tzinfo/countries/UZ.rb +0 -13
- data/lib/tzinfo/countries/VA.rb +0 -12
- data/lib/tzinfo/countries/VC.rb +0 -12
- data/lib/tzinfo/countries/VE.rb +0 -12
- data/lib/tzinfo/countries/VG.rb +0 -12
- data/lib/tzinfo/countries/VI.rb +0 -12
- data/lib/tzinfo/countries/VN.rb +0 -12
- data/lib/tzinfo/countries/VU.rb +0 -12
- data/lib/tzinfo/countries/WF.rb +0 -12
- data/lib/tzinfo/countries/WS.rb +0 -12
- data/lib/tzinfo/countries/YE.rb +0 -12
- data/lib/tzinfo/countries/YT.rb +0 -12
- data/lib/tzinfo/countries/ZA.rb +0 -12
- data/lib/tzinfo/countries/ZM.rb +0 -12
- data/lib/tzinfo/countries/ZW.rb +0 -12
- data/lib/tzinfo/timezone_period_list.rb +0 -234
- data/test/tc_timezone_period_list.rb +0 -310
data/test/tc_timezone.rb
CHANGED
@@ -1,89 +1,136 @@
|
|
1
1
|
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
2
2
|
require 'test/unit'
|
3
|
+
require 'tzinfo/data_timezone'
|
4
|
+
require 'tzinfo/linked_timezone'
|
5
|
+
require 'tzinfo/time_or_datetime'
|
3
6
|
require 'tzinfo/timezone'
|
7
|
+
require 'tzinfo/timezone_offset_info'
|
8
|
+
require 'tzinfo/timezone_period'
|
9
|
+
require 'tzinfo/timezone_proxy'
|
10
|
+
require 'tzinfo/timezone_transition_info'
|
4
11
|
|
5
12
|
include TZInfo
|
6
13
|
|
7
|
-
class TCTimezoneBlockCalled < StandardError
|
8
|
-
end
|
9
|
-
|
10
14
|
class TCTimezone < Test::Unit::TestCase
|
15
|
+
|
16
|
+
class BlockCalled < StandardError
|
17
|
+
end
|
18
|
+
|
19
|
+
class TestTimezone < Timezone
|
20
|
+
def self.new(identifier, period_for_utc = nil, periods_for_local = nil, expected = nil)
|
21
|
+
t = super()
|
22
|
+
t.send(:setup, identifier, period_for_utc, periods_for_local, expected)
|
23
|
+
t
|
24
|
+
end
|
25
|
+
|
26
|
+
def identifier
|
27
|
+
@identifier
|
28
|
+
end
|
29
|
+
|
30
|
+
def period_for_utc(utc)
|
31
|
+
utc = TimeOrDateTime.wrap(utc)
|
32
|
+
raise "Unexpected utc #{utc} in period_for_utc" unless @expected.eql?(utc)
|
33
|
+
@period_for_utc
|
34
|
+
end
|
35
|
+
|
36
|
+
def periods_for_local(local)
|
37
|
+
local = TimeOrDateTime.wrap(local)
|
38
|
+
raise "Unexpected local #{local} in periods_for_local" unless @expected.eql?(local)
|
39
|
+
@periods_for_local.clone
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
def setup(identifier, period_for_utc, periods_for_local, expected)
|
44
|
+
@identifier = identifier
|
45
|
+
@period_for_utc = period_for_utc
|
46
|
+
@periods_for_local = periods_for_local || []
|
47
|
+
@expected = TimeOrDateTime.wrap(expected)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
11
51
|
def test_get_valid_1
|
12
52
|
tz = Timezone.get('Europe/London')
|
13
53
|
|
14
|
-
|
15
|
-
require 'tzinfo/definitions/Europe/London'
|
16
|
-
assert_same(Definitions::Europe::London.instance, tz)
|
54
|
+
assert_kind_of(DataTimezone, tz)
|
17
55
|
assert_equal('Europe/London', tz.identifier)
|
18
56
|
end
|
19
57
|
|
20
58
|
def test_get_valid_2
|
21
59
|
tz = Timezone.get('UTC')
|
22
60
|
|
23
|
-
|
24
|
-
require 'tzinfo/definitions/UTC'
|
25
|
-
assert_same(Definitions::UTC.instance, tz)
|
61
|
+
assert_kind_of(LinkedTimezone, tz)
|
26
62
|
assert_equal('UTC', tz.identifier)
|
27
63
|
end
|
28
64
|
|
29
65
|
def test_get_valid_3
|
30
66
|
tz = Timezone.get('America/Argentina/Buenos_Aires')
|
31
67
|
|
32
|
-
|
33
|
-
assert_same(Definitions::America::Argentina::Buenos_Aires.instance, tz)
|
34
|
-
require 'tzinfo/definitions/America/Argentina/Buenos_Aires'
|
68
|
+
assert_kind_of(DataTimezone, tz)
|
35
69
|
assert_equal('America/Argentina/Buenos_Aires', tz.identifier)
|
36
70
|
end
|
37
71
|
|
72
|
+
def test_get_same_instance
|
73
|
+
tz1 = Timezone.get('Europe/London')
|
74
|
+
tz2 = Timezone.get('Europe/London')
|
75
|
+
assert_same(tz1, tz2)
|
76
|
+
end
|
77
|
+
|
38
78
|
def test_get_not_exist
|
39
|
-
assert_raise(InvalidTimezoneIdentifier) {
|
40
|
-
Timezone.get('Nowhere/Special')
|
41
|
-
}
|
79
|
+
assert_raise(InvalidTimezoneIdentifier) { Timezone.get('Nowhere/Special') }
|
42
80
|
end
|
43
81
|
|
44
82
|
def test_get_invalid
|
45
|
-
assert_raise(InvalidTimezoneIdentifier) {
|
46
|
-
Timezone.get('../Definitions/UTC')
|
47
|
-
}
|
83
|
+
assert_raise(InvalidTimezoneIdentifier) { Timezone.get('../Definitions/UTC') }
|
48
84
|
end
|
49
85
|
|
50
86
|
def test_get_nil
|
51
|
-
assert_raise(InvalidTimezoneIdentifier) {
|
52
|
-
Timezone.get(nil)
|
53
|
-
}
|
87
|
+
assert_raise(InvalidTimezoneIdentifier) { Timezone.get(nil) }
|
54
88
|
end
|
55
89
|
|
56
90
|
def test_get_plus
|
57
91
|
tz = Timezone.get('Etc/GMT+1')
|
58
92
|
|
59
|
-
assert_not_nil(tz)
|
60
|
-
assert_same(Definitions::Etc::GMT__p__1.instance, tz)
|
61
93
|
assert_equal('Etc/GMT+1', tz.identifier)
|
62
94
|
end
|
63
95
|
|
64
96
|
def test_get_minus
|
65
97
|
tz = Timezone.get('Etc/GMT-1')
|
66
98
|
|
67
|
-
assert_not_nil(tz)
|
68
|
-
assert_same(Definitions::Etc::GMT__m__1.instance, tz)
|
69
99
|
assert_equal('Etc/GMT-1', tz.identifier)
|
70
100
|
end
|
71
101
|
|
72
102
|
def test_get_case
|
73
103
|
Timezone.get('Europe/Prague')
|
74
|
-
assert_raise(InvalidTimezoneIdentifier) {
|
75
|
-
|
76
|
-
|
104
|
+
assert_raise(InvalidTimezoneIdentifier) { Timezone.get('Europe/prague') }
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_get_proxy_valid
|
108
|
+
proxy = Timezone.get_proxy('Europe/London')
|
109
|
+
assert_kind_of(TimezoneProxy, proxy)
|
110
|
+
assert_equal('Europe/London', proxy.identifier)
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_get_proxy_not_exist
|
114
|
+
proxy = Timezone.get_proxy('Not/There')
|
115
|
+
assert_kind_of(TimezoneProxy, proxy)
|
116
|
+
assert_equal('Not/There', proxy.identifier)
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_get_proxy_invalid
|
120
|
+
proxy = Timezone.get_proxy('../Invalid/Identifier')
|
121
|
+
assert_kind_of(TimezoneProxy, proxy)
|
122
|
+
assert_equal('../Invalid/Identifier', proxy.identifier)
|
77
123
|
end
|
78
124
|
|
79
125
|
def test_new_no_args
|
80
126
|
tz = Timezone.new
|
81
127
|
|
82
|
-
|
83
|
-
|
128
|
+
assert_raise(UnknownTimezone) { tz.identifier }
|
129
|
+
assert_raise(UnknownTimezone) { tz.friendly_identifier }
|
84
130
|
assert_raise(UnknownTimezone) { tz.utc_to_local(DateTime.new(2006,1,1,1,0,0)) }
|
85
131
|
assert_raise(UnknownTimezone) { tz.local_to_utc(DateTime.new(2006,1,1,1,0,0)) }
|
86
132
|
assert_raise(UnknownTimezone) { tz.period_for_utc(DateTime.new(2006,1,1,1,0,0)) }
|
133
|
+
assert_raise(UnknownTimezone) { tz.periods_for_local(DateTime.new(2006,1,1,1,0,0)) }
|
87
134
|
assert_raise(UnknownTimezone) { tz.period_for_local(DateTime.new(2006,1,1,1,0,0)) }
|
88
135
|
assert_raise(UnknownTimezone) { tz.now }
|
89
136
|
assert_raise(UnknownTimezone) { tz.current_period_and_time }
|
@@ -92,14 +139,15 @@ class TCTimezone < Test::Unit::TestCase
|
|
92
139
|
def test_new_nil
|
93
140
|
tz = Timezone.new(nil)
|
94
141
|
|
95
|
-
|
96
|
-
|
142
|
+
assert_raise(UnknownTimezone) { tz.identifier }
|
143
|
+
assert_raise(UnknownTimezone) { tz.friendly_identifier }
|
97
144
|
assert_raise(UnknownTimezone) { tz.utc_to_local(DateTime.new(2006,1,1,1,0,0)) }
|
98
145
|
assert_raise(UnknownTimezone) { tz.local_to_utc(DateTime.new(2006,1,1,1,0,0)) }
|
99
146
|
assert_raise(UnknownTimezone) { tz.period_for_utc(DateTime.new(2006,1,1,1,0,0)) }
|
147
|
+
assert_raise(UnknownTimezone) { tz.periods_for_local(DateTime.new(2006,1,1,1,0,0)) }
|
100
148
|
assert_raise(UnknownTimezone) { tz.period_for_local(DateTime.new(2006,1,1,1,0,0)) }
|
101
149
|
assert_raise(UnknownTimezone) { tz.now }
|
102
|
-
assert_raise(UnknownTimezone) { tz.current_period_and_time }
|
150
|
+
assert_raise(UnknownTimezone) { tz.current_period_and_time }
|
103
151
|
end
|
104
152
|
|
105
153
|
def test_new_arg
|
@@ -108,17 +156,40 @@ class TCTimezone < Test::Unit::TestCase
|
|
108
156
|
end
|
109
157
|
|
110
158
|
def test_new_arg_not_exist
|
111
|
-
assert_raise(InvalidTimezoneIdentifier) {
|
112
|
-
Timezone.new('Nowhere/Special')
|
113
|
-
}
|
159
|
+
assert_raise(InvalidTimezoneIdentifier) { Timezone.new('Nowhere/Special') }
|
114
160
|
end
|
115
161
|
|
116
162
|
def test_all
|
117
|
-
|
163
|
+
all = Timezone.all
|
164
|
+
expected = Indexes::Timezones.timezones.collect {|identifier| Timezone.get_proxy(identifier)}
|
165
|
+
assert_equal(expected, all)
|
118
166
|
end
|
119
167
|
|
120
168
|
def test_all_identifiers
|
121
|
-
|
169
|
+
all = Timezone.all_identifiers
|
170
|
+
assert_equal(Indexes::Timezones.timezones, all)
|
171
|
+
end
|
172
|
+
|
173
|
+
def test_all_data_zones
|
174
|
+
all_data = Timezone.all_data_zones
|
175
|
+
expected = Indexes::Timezones.data_timezones.collect {|identifier| Timezone.get_proxy(identifier)}
|
176
|
+
assert_equal(expected, all_data)
|
177
|
+
end
|
178
|
+
|
179
|
+
def test_all_data_zone_identifiers
|
180
|
+
all_data = Timezone.all_data_zone_identifiers
|
181
|
+
assert_equal(Indexes::Timezones.data_timezones, all_data)
|
182
|
+
end
|
183
|
+
|
184
|
+
def test_all_linked_zones
|
185
|
+
all_linked = Timezone.all_linked_zones
|
186
|
+
expected = Indexes::Timezones.linked_timezones.collect {|identifier| Timezone.get_proxy(identifier)}
|
187
|
+
assert_equal(expected, all_linked)
|
188
|
+
end
|
189
|
+
|
190
|
+
def test_all_linked_zone_identifiers
|
191
|
+
all_linked = Timezone.all_linked_zone_identifiers
|
192
|
+
assert_equal(Indexes::Timezones.linked_timezones, all_linked)
|
122
193
|
end
|
123
194
|
|
124
195
|
def test_all_country_zones
|
@@ -171,147 +242,181 @@ class TCTimezone < Test::Unit::TestCase
|
|
171
242
|
# Probably should relax this test - just need all the zones, don't care
|
172
243
|
# about order.
|
173
244
|
assert_equal(Country.get('US').zone_identifiers.uniq, Timezone.us_zone_identifiers)
|
174
|
-
end
|
245
|
+
end
|
175
246
|
|
176
247
|
def test_identifier
|
177
|
-
|
178
|
-
assert_equal('Europe/Paris',
|
248
|
+
assert_raise(UnknownTimezone) { Timezone.new.identifier }
|
249
|
+
assert_equal('Europe/Paris', TestTimezone.new('Europe/Paris').identifier)
|
179
250
|
end
|
180
251
|
|
181
252
|
def test_name
|
182
|
-
|
183
|
-
assert_equal('Europe/Paris',
|
253
|
+
assert_raise(UnknownTimezone) { Timezone.new.name }
|
254
|
+
assert_equal('Europe/Paris', TestTimezone.new('Europe/Paris').name)
|
184
255
|
end
|
185
256
|
|
186
257
|
def test_friendly_identifier
|
187
|
-
assert_equal('Paris',
|
188
|
-
assert_equal('Europe - Paris',
|
189
|
-
assert_equal('Europe - Paris',
|
190
|
-
assert_equal('Knox, Indiana',
|
191
|
-
assert_equal('America - Knox, Indiana',
|
192
|
-
assert_equal('America - Knox, Indiana',
|
193
|
-
assert_equal('Dumont D\'Urville',
|
194
|
-
assert_equal('Antarctica - Dumont D\'Urville',
|
195
|
-
assert_equal('Antarctica - Dumont D\'Urville',
|
196
|
-
assert_equal('McMurdo',
|
197
|
-
assert_equal('Antarctica - McMurdo',
|
198
|
-
assert_equal('Antarctica - McMurdo',
|
199
|
-
assert_equal('GMT+1',
|
200
|
-
assert_equal('Etc - GMT+1',
|
201
|
-
assert_equal('Etc - GMT+1',
|
202
|
-
assert_equal('UTC',
|
203
|
-
assert_equal('UTC',
|
204
|
-
assert_equal('UTC',
|
258
|
+
assert_equal('Paris', TestTimezone.new('Europe/Paris').friendly_identifier(true))
|
259
|
+
assert_equal('Europe - Paris', TestTimezone.new('Europe/Paris').friendly_identifier(false))
|
260
|
+
assert_equal('Europe - Paris', TestTimezone.new('Europe/Paris').friendly_identifier)
|
261
|
+
assert_equal('Knox, Indiana', TestTimezone.new('America/Indiana/Knox').friendly_identifier(true))
|
262
|
+
assert_equal('America - Knox, Indiana', TestTimezone.new('America/Indiana/Knox').friendly_identifier(false))
|
263
|
+
assert_equal('America - Knox, Indiana', TestTimezone.new('America/Indiana/Knox').friendly_identifier)
|
264
|
+
assert_equal('Dumont D\'Urville', TestTimezone.new('Antarctica/DumontDUrville').friendly_identifier(true))
|
265
|
+
assert_equal('Antarctica - Dumont D\'Urville', TestTimezone.new('Antarctica/DumontDUrville').friendly_identifier(false))
|
266
|
+
assert_equal('Antarctica - Dumont D\'Urville', TestTimezone.new('Antarctica/DumontDUrville').friendly_identifier)
|
267
|
+
assert_equal('McMurdo', TestTimezone.new('Antarctica/McMurdo').friendly_identifier(true))
|
268
|
+
assert_equal('Antarctica - McMurdo', TestTimezone.new('Antarctica/McMurdo').friendly_identifier(false))
|
269
|
+
assert_equal('Antarctica - McMurdo', TestTimezone.new('Antarctica/McMurdo').friendly_identifier)
|
270
|
+
assert_equal('GMT+1', TestTimezone.new('Etc/GMT+1').friendly_identifier(true))
|
271
|
+
assert_equal('Etc - GMT+1', TestTimezone.new('Etc/GMT+1').friendly_identifier(false))
|
272
|
+
assert_equal('Etc - GMT+1', TestTimezone.new('Etc/GMT+1').friendly_identifier)
|
273
|
+
assert_equal('UTC', TestTimezone.new('UTC').friendly_identifier(true))
|
274
|
+
assert_equal('UTC', TestTimezone.new('UTC').friendly_identifier(false))
|
275
|
+
assert_equal('UTC', TestTimezone.new('UTC').friendly_identifier)
|
205
276
|
end
|
206
277
|
|
207
278
|
def test_to_s
|
208
|
-
assert_equal('Europe - Paris',
|
209
|
-
assert_equal('America - Knox, Indiana',
|
210
|
-
assert_equal('Antarctica - Dumont D\'Urville',
|
211
|
-
assert_equal('Antarctica - McMurdo',
|
212
|
-
assert_equal('Etc - GMT+1',
|
213
|
-
assert_equal('UTC',
|
279
|
+
assert_equal('Europe - Paris', TestTimezone.new('Europe/Paris').to_s)
|
280
|
+
assert_equal('America - Knox, Indiana', TestTimezone.new('America/Indiana/Knox').to_s)
|
281
|
+
assert_equal('Antarctica - Dumont D\'Urville', TestTimezone.new('Antarctica/DumontDUrville').to_s)
|
282
|
+
assert_equal('Antarctica - McMurdo', TestTimezone.new('Antarctica/McMurdo').to_s)
|
283
|
+
assert_equal('Etc - GMT+1', TestTimezone.new('Etc/GMT+1').to_s)
|
284
|
+
assert_equal('UTC', TestTimezone.new('UTC').to_s)
|
214
285
|
end
|
215
|
-
|
216
|
-
def
|
286
|
+
|
287
|
+
def test_period_for_local
|
217
288
|
dt = DateTime.new(2005,2,18,16,24,23)
|
218
289
|
dt2 = DateTime.new(2005,2,18,16,24,23).new_offset(Rational(5,24))
|
219
290
|
t = Time.utc(2005,2,18,16,24,23)
|
220
291
|
t2 = Time.local(2005,2,18,16,24,23)
|
221
292
|
ts = t.to_i
|
222
|
-
|
223
|
-
dt_period = Timezone.get('Europe/London').period_for_utc(dt)
|
224
|
-
dt2_period = Timezone.get('Europe/London').period_for_utc(dt2)
|
225
|
-
t_period = Timezone.get('Europe/London').period_for_utc(t)
|
226
|
-
t2_period = Timezone.get('Europe/London').period_for_utc(t2)
|
227
|
-
ts_period = Timezone.get('Europe/London').period_for_utc(ts)
|
228
293
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
assert_equal(DateTime.new(2004,10,31,1,0,0), t_period.utc_start)
|
236
|
-
assert_equal(DateTime.new(2005,3,27,1,0,0), t_period.utc_end)
|
294
|
+
o1 = TimezoneOffsetInfo.new(0, 0, :GMT)
|
295
|
+
o2 = TimezoneOffsetInfo.new(0, 3600, :BST)
|
296
|
+
|
297
|
+
period = TimezonePeriod.new(
|
298
|
+
TimezoneTransitionInfo.new(o1, o2, 1099184400),
|
299
|
+
TimezoneTransitionInfo.new(o2, o1, 1111885200))
|
237
300
|
|
238
|
-
|
239
|
-
|
301
|
+
dt_period = TestTimezone.new('Europe/London', nil, [period], dt).period_for_local(dt)
|
302
|
+
dt2_period = TestTimezone.new('Europe/London', nil, [period], dt2).period_for_local(dt2)
|
303
|
+
t_period = TestTimezone.new('Europe/London', nil, [period], t).period_for_local(t)
|
304
|
+
t2_period = TestTimezone.new('Europe/London', nil, [period], t2).period_for_local(t2)
|
305
|
+
ts_period = TestTimezone.new('Europe/London', nil, [period], ts).period_for_local(ts)
|
240
306
|
|
241
|
-
assert_equal(
|
242
|
-
assert_equal(
|
307
|
+
assert_equal(period, dt_period)
|
308
|
+
assert_equal(period, dt2_period)
|
309
|
+
assert_equal(period, t_period)
|
310
|
+
assert_equal(period, t2_period)
|
311
|
+
assert_equal(period, ts_period)
|
243
312
|
end
|
244
313
|
|
245
|
-
def
|
246
|
-
dt = DateTime.new(
|
247
|
-
|
248
|
-
t = Time.utc(2005,2,18,16,24,23)
|
249
|
-
t2 = Time.local(2005,2,18,16,24,23)
|
250
|
-
ts = t.to_i
|
251
|
-
|
252
|
-
dt_period = Timezone.get('Europe/London').period_for_local(dt)
|
253
|
-
dt2_period = Timezone.get('Europe/London').period_for_local(dt2)
|
254
|
-
t_period = Timezone.get('Europe/London').period_for_local(t)
|
255
|
-
t2_period = Timezone.get('Europe/London').period_for_local(t2)
|
256
|
-
ts_period = Timezone.get('Europe/London').period_for_local(ts)
|
314
|
+
def test_period_for_local_invalid
|
315
|
+
dt = DateTime.new(2004,4,4,2,30,0)
|
316
|
+
tz = TestTimezone.new('America/New_York', nil, [], dt)
|
257
317
|
|
258
|
-
|
259
|
-
|
318
|
+
assert_raise(PeriodNotFound) do
|
319
|
+
tz.period_for_local(dt)
|
320
|
+
end
|
321
|
+
end
|
322
|
+
|
323
|
+
def test_period_for_local_ambiguous
|
324
|
+
o1 = TimezoneOffsetInfo.new(-18000, 0, :EST)
|
325
|
+
o2 = TimezoneOffsetInfo.new(-18000, 3600, :EDT)
|
260
326
|
|
261
|
-
|
262
|
-
|
327
|
+
t1 = TimezoneTransitionInfo.new(o2, o1, 1081062000)
|
328
|
+
t2 = TimezoneTransitionInfo.new(o1, o2, 1099202400)
|
329
|
+
t3 = TimezoneTransitionInfo.new(o2, o1, 1112511600)
|
263
330
|
|
264
|
-
|
265
|
-
|
331
|
+
p1 = TimezonePeriod.new(t1, t2)
|
332
|
+
p2 = TimezonePeriod.new(t2, t3)
|
266
333
|
|
267
|
-
|
268
|
-
|
334
|
+
dt = DateTime.new(2004,10,31,1, 0,0)
|
335
|
+
t = Time.utc(2004,10,31,1,30,0)
|
336
|
+
i = Time.utc(2004,10,31,1,59,59).to_i
|
269
337
|
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
assert_raise(
|
276
|
-
|
277
|
-
}
|
338
|
+
dt_tz = TestTimezone.new('America/New_York', nil, [p1, p2], dt)
|
339
|
+
t_tz = TestTimezone.new('America/New_York', nil, [p1, p2], t)
|
340
|
+
i_tz = TestTimezone.new('America/New_York', nil, [p1, p2], i)
|
341
|
+
|
342
|
+
assert_raise(AmbiguousTime) { dt_tz.period_for_local(dt) }
|
343
|
+
assert_raise(AmbiguousTime) { t_tz.period_for_local(t) }
|
344
|
+
assert_raise(AmbiguousTime) { i_tz.period_for_local(i) }
|
278
345
|
end
|
279
346
|
|
280
|
-
def
|
281
|
-
|
282
|
-
|
283
|
-
|
347
|
+
def test_period_for_local_not_found
|
348
|
+
o1 = TimezoneOffsetInfo.new(-18000, 0, :EST)
|
349
|
+
o2 = TimezoneOffsetInfo.new(-18000, 3600, :EDT)
|
350
|
+
|
351
|
+
t1 = TimezoneTransitionInfo.new(o1, o2, 1067148000)
|
352
|
+
t2 = TimezoneTransitionInfo.new(o2, o1, 1081062000)
|
353
|
+
t3 = TimezoneTransitionInfo.new(o1, o2, 1099202400)
|
354
|
+
|
355
|
+
p1 = TimezonePeriod.new(t1, t2)
|
356
|
+
p2 = TimezonePeriod.new(t2, t3)
|
357
|
+
|
358
|
+
dt = DateTime.new(2004,4,4,2,0,0)
|
359
|
+
t = Time.utc(2004,4,4,2,30,0)
|
360
|
+
i = Time.utc(2004,4,4,2,59,59).to_i
|
361
|
+
|
362
|
+
dt_tz = TestTimezone.new('America/New_York', nil, [], dt)
|
363
|
+
t_tz = TestTimezone.new('America/New_York', nil, [], t)
|
364
|
+
i_tz = TestTimezone.new('America/New_York', nil, [], i)
|
365
|
+
|
366
|
+
assert_raise(PeriodNotFound) { dt_tz.period_for_local(dt) }
|
367
|
+
assert_raise(PeriodNotFound) { t_tz.period_for_local(t) }
|
368
|
+
assert_raise(PeriodNotFound) { i_tz.period_for_local(i) }
|
284
369
|
end
|
285
370
|
|
286
371
|
def test_period_for_local_dst_flag_resolved
|
372
|
+
o1 = TimezoneOffsetInfo.new(-18000, 0, :EST)
|
373
|
+
o2 = TimezoneOffsetInfo.new(-18000, 3600, :EDT)
|
374
|
+
|
375
|
+
t1 = TimezoneTransitionInfo.new(o2, o1, 1081062000)
|
376
|
+
t2 = TimezoneTransitionInfo.new(o1, o2, 1099202400)
|
377
|
+
t3 = TimezoneTransitionInfo.new(o2, o1, 1112511600)
|
378
|
+
|
379
|
+
p1 = TimezonePeriod.new(t1, t2)
|
380
|
+
p2 = TimezonePeriod.new(t2, t3)
|
381
|
+
|
287
382
|
dt = DateTime.new(2004,10,31,1,30,0)
|
288
|
-
tz = Timezone.get('America/New_York')
|
289
383
|
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
384
|
+
tz = TestTimezone.new('America/New_York', nil, [p1, p2], dt)
|
385
|
+
|
386
|
+
assert_equal(p1, tz.period_for_local(dt, true))
|
387
|
+
assert_equal(p2, tz.period_for_local(dt, false))
|
388
|
+
assert_equal(p1, tz.period_for_local(dt, true) {|periods| raise BlockCalled, 'should not be called' })
|
389
|
+
assert_equal(p2, tz.period_for_local(dt, false) {|periods| raise BlockCalled, 'should not be called' })
|
294
390
|
end
|
295
391
|
|
296
392
|
def test_period_for_local_dst_block_called
|
393
|
+
o1 = TimezoneOffsetInfo.new(-18000, 0, :EST)
|
394
|
+
o2 = TimezoneOffsetInfo.new(-18000, 3600, :EDT)
|
395
|
+
|
396
|
+
t1 = TimezoneTransitionInfo.new(o2, o1, 1081062000)
|
397
|
+
t2 = TimezoneTransitionInfo.new(o1, o2, 1099202400)
|
398
|
+
t3 = TimezoneTransitionInfo.new(o2, o1, 1112511600)
|
399
|
+
|
400
|
+
p1 = TimezonePeriod.new(t1, t2)
|
401
|
+
p2 = TimezonePeriod.new(t2, t3)
|
402
|
+
|
297
403
|
dt = DateTime.new(2004,10,31,1,30,0)
|
298
|
-
tz = Timezone.get('America/New_York')
|
299
404
|
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
405
|
+
tz = TestTimezone.new('America/New_York', nil, [p1, p2], dt)
|
406
|
+
|
407
|
+
assert_raise(BlockCalled) {
|
408
|
+
tz.period_for_local(dt) {|periods|
|
409
|
+
assert_equal([p1, p2], periods)
|
305
410
|
|
306
411
|
# raise exception to test that the block was called
|
307
|
-
raise
|
412
|
+
raise BlockCalled, 'should be raised'
|
308
413
|
}
|
309
414
|
}
|
310
415
|
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
416
|
+
assert_equal(p1, tz.period_for_local(dt) {|periods| periods.first})
|
417
|
+
assert_equal(p2, tz.period_for_local(dt) {|periods| periods.last})
|
418
|
+
assert_equal(p1, tz.period_for_local(dt) {|periods| [periods.first]})
|
419
|
+
assert_equal(p2, tz.period_for_local(dt) {|periods| [periods.last]})
|
315
420
|
end
|
316
421
|
|
317
422
|
def test_period_for_local_dst_cannot_resolve
|
@@ -319,215 +424,326 @@ class TCTimezone < Test::Unit::TestCase
|
|
319
424
|
# 24 minutes and both periods were non-DST. Hence the block should be
|
320
425
|
# called regardless of the value of the Boolean dst parameter.
|
321
426
|
|
427
|
+
o0 = TimezoneOffsetInfo.new(5040, 0, :LMT)
|
428
|
+
o1 = TimezoneOffsetInfo.new(5040, 0, :WMT)
|
429
|
+
o2 = TimezoneOffsetInfo.new(3600, 0, :CET)
|
430
|
+
o3 = TimezoneOffsetInfo.new(3600, 3600, :CEST)
|
431
|
+
|
432
|
+
t1 = TimezoneTransitionInfo.new(o1, o0, 288925853, 120)
|
433
|
+
t2 = TimezoneTransitionInfo.new(o2, o1, 290485733, 120)
|
434
|
+
t3 = TimezoneTransitionInfo.new(o3, o2, 29051813, 12)
|
435
|
+
|
436
|
+
p1 = TimezonePeriod.new(t1, t2)
|
437
|
+
p2 = TimezonePeriod.new(t2, t3)
|
438
|
+
|
322
439
|
dt = DateTime.new(1915,8,4,23,40,0)
|
323
|
-
tz = Timezone.get('Europe/Warsaw')
|
324
440
|
|
325
|
-
|
326
|
-
tz.period_for_local(dt, true) {|periods|
|
327
|
-
assert_equal(2, periods.size)
|
328
|
-
assert_equal(DateTime.new(1915,8,4,22,36,0), periods[0].utc_end)
|
329
|
-
assert_equal(false, periods[0].dst?)
|
330
|
-
assert_period_for(DateTime.new(1915,8,4,22,36,0), DateTime.new(1916,4,30,22,0,0), false, periods[1])
|
441
|
+
tz = TestTimezone.new('Europe/Warsaw', nil, [p1, p2], dt)
|
331
442
|
|
332
|
-
|
443
|
+
assert_raise(BlockCalled) {
|
444
|
+
tz.period_for_local(dt, true) {|periods|
|
445
|
+
assert_equal([p1, p2], periods)
|
446
|
+
raise BlockCalled, 'should be raised'
|
333
447
|
}
|
334
448
|
}
|
335
449
|
|
336
|
-
assert_raise(
|
450
|
+
assert_raise(BlockCalled) {
|
337
451
|
tz.period_for_local(dt, false) {|periods|
|
338
|
-
assert_equal(
|
339
|
-
|
340
|
-
assert_equal(false, periods[0].dst?)
|
341
|
-
assert_period_for(DateTime.new(1915,8,4,22,36,0), DateTime.new(1916,4,30,22,0,0), false, periods[1])
|
342
|
-
|
343
|
-
raise TCTimezoneBlockCalled, 'should be raised'
|
452
|
+
assert_equal([p1, p2], periods)
|
453
|
+
raise BlockCalled, 'should be raised'
|
344
454
|
}
|
345
455
|
}
|
346
456
|
end
|
347
457
|
|
348
458
|
def test_period_for_local_block_ambiguous
|
459
|
+
o1 = TimezoneOffsetInfo.new(-18000, 0, :EST)
|
460
|
+
o2 = TimezoneOffsetInfo.new(-18000, 3600, :EDT)
|
461
|
+
|
462
|
+
t1 = TimezoneTransitionInfo.new(o2, o1, 1081062000)
|
463
|
+
t2 = TimezoneTransitionInfo.new(o1, o2, 1099202400)
|
464
|
+
t3 = TimezoneTransitionInfo.new(o2, o1, 1112511600)
|
465
|
+
|
466
|
+
p1 = TimezonePeriod.new(t1, t2)
|
467
|
+
p2 = TimezonePeriod.new(t2, t3)
|
468
|
+
|
349
469
|
dt = DateTime.new(2004,10,31,1,30,0)
|
350
|
-
tz = Timezone.get('America/New_York')
|
351
470
|
|
352
|
-
|
471
|
+
tz = TestTimezone.new('America/New_York', nil, [p1, p2], dt)
|
472
|
+
|
473
|
+
assert_raise(AmbiguousTime) do
|
353
474
|
tz.period_for_local(dt) {|periods| nil}
|
354
|
-
|
475
|
+
end
|
355
476
|
|
356
|
-
assert_raise(AmbiguousTime)
|
477
|
+
assert_raise(AmbiguousTime) do
|
357
478
|
tz.period_for_local(dt) {|periods| periods}
|
358
|
-
|
479
|
+
end
|
359
480
|
|
360
|
-
assert_raise(AmbiguousTime)
|
481
|
+
assert_raise(AmbiguousTime) do
|
361
482
|
tz.period_for_local(dt) {|periods| []}
|
362
|
-
|
483
|
+
end
|
363
484
|
|
364
|
-
assert_raise(AmbiguousTime)
|
485
|
+
assert_raise(AmbiguousTime) do
|
365
486
|
tz.period_for_local(dt) {|periods| raise AmbiguousTime, 'Ambiguous time'}
|
366
|
-
|
487
|
+
end
|
367
488
|
end
|
368
489
|
|
369
490
|
def test_utc_to_local
|
370
|
-
dt = DateTime.new(2005,
|
371
|
-
dt2 = DateTime.new(2005,
|
372
|
-
t = Time.utc(2005,
|
373
|
-
t2 = Time.local(2005,
|
491
|
+
dt = DateTime.new(2005,6,18,16,24,23)
|
492
|
+
dt2 = DateTime.new(2005,6,18,16,24,23).new_offset(Rational(5,24))
|
493
|
+
t = Time.utc(2005,6,18,16,24,23)
|
494
|
+
t2 = Time.local(2005,6,18,16,24,23)
|
374
495
|
ts = t.to_i
|
496
|
+
|
497
|
+
o1 = TimezoneOffsetInfo.new(0, 0, :GMT)
|
498
|
+
o2 = TimezoneOffsetInfo.new(0, 3600, :BST)
|
499
|
+
|
500
|
+
period = TimezonePeriod.new(
|
501
|
+
TimezoneTransitionInfo.new(o2, o1, 1111885200),
|
502
|
+
TimezoneTransitionInfo.new(o1, o2, 1130634000))
|
375
503
|
|
376
|
-
assert_equal(
|
377
|
-
assert_equal(
|
378
|
-
assert_equal(
|
379
|
-
assert_equal(
|
380
|
-
assert_equal(
|
504
|
+
assert_equal(DateTime.new(2005,6,18,17,24,23), TestTimezone.new('Europe/London', period, [], dt).utc_to_local(dt))
|
505
|
+
assert_equal(DateTime.new(2005,6,18,17,24,23), TestTimezone.new('Europe/London', period, [], dt2).utc_to_local(dt2))
|
506
|
+
assert_equal(Time.utc(2005,6,18,17,24,23), TestTimezone.new('Europe/London', period, [], t).utc_to_local(t))
|
507
|
+
assert_equal(Time.utc(2005,6,18,17,24,23), TestTimezone.new('Europe/London', period, [], t2).utc_to_local(t2))
|
508
|
+
assert_equal(Time.utc(2005,6,18,17,24,23).to_i, TestTimezone.new('Europe/London', period, [], ts).utc_to_local(ts))
|
381
509
|
end
|
382
510
|
|
383
511
|
def test_utc_to_local_offset
|
384
|
-
dt = DateTime.new(2005,
|
385
|
-
dt2 = DateTime.new(2005,
|
386
|
-
t = Time.utc(2005,
|
387
|
-
t2 = Time.local(2005,
|
512
|
+
dt = DateTime.new(2005,6,18,16,24,23)
|
513
|
+
dt2 = DateTime.new(2005,6,18,16,24,23).new_offset(Rational(5,24))
|
514
|
+
t = Time.utc(2005,6,18,16,24,23)
|
515
|
+
t2 = Time.local(2005,6,18,16,24,23)
|
516
|
+
|
517
|
+
o1 = TimezoneOffsetInfo.new(0, 0, :GMT)
|
518
|
+
o2 = TimezoneOffsetInfo.new(0, 3600, :BST)
|
519
|
+
|
520
|
+
period = TimezonePeriod.new(
|
521
|
+
TimezoneTransitionInfo.new(o2, o1, 1111885200),
|
522
|
+
TimezoneTransitionInfo.new(o1, o2, 1130634000))
|
388
523
|
|
389
|
-
assert_equal(0,
|
390
|
-
assert_equal(0,
|
391
|
-
assert_equal(0,
|
392
|
-
assert_equal('UTC',
|
393
|
-
assert_equal(0,
|
394
|
-
assert_equal('UTC',
|
524
|
+
assert_equal(0, TestTimezone.new('Europe/London', period, [], dt).utc_to_local(dt).offset)
|
525
|
+
assert_equal(0, TestTimezone.new('Europe/London', period, [], dt2).utc_to_local(dt2).offset)
|
526
|
+
assert_equal(0, TestTimezone.new('Europe/London', period, [], t).utc_to_local(t).utc_offset)
|
527
|
+
assert_equal('UTC', TestTimezone.new('Europe/London', period, [], t).utc_to_local(t).zone)
|
528
|
+
assert_equal(0, TestTimezone.new('Europe/London', period, [], t2).utc_to_local(t2).utc_offset)
|
529
|
+
assert_equal('UTC', TestTimezone.new('Europe/London', period, [], t2).utc_to_local(t2).zone)
|
395
530
|
end
|
396
531
|
|
397
532
|
def test_local_to_utc
|
398
|
-
dt = DateTime.new(2005,
|
399
|
-
dt2 = DateTime.new(2005,
|
400
|
-
t = Time.utc(2005,
|
401
|
-
t2 = Time.local(2005,
|
533
|
+
dt = DateTime.new(2005,6,18,16,24,23)
|
534
|
+
dt2 = DateTime.new(2005,6,18,16,24,23)
|
535
|
+
t = Time.utc(2005,6,18,16,24,23)
|
536
|
+
t2 = Time.local(2005,6,18,16,24,23)
|
402
537
|
ts = t.to_i
|
403
538
|
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
539
|
+
o1 = TimezoneOffsetInfo.new(0, 0, :GMT)
|
540
|
+
o2 = TimezoneOffsetInfo.new(0, 3600, :BST)
|
541
|
+
|
542
|
+
period = TimezonePeriod.new(
|
543
|
+
TimezoneTransitionInfo.new(o2, o1, 1111885200),
|
544
|
+
TimezoneTransitionInfo.new(o1, o2, 1130634000))
|
545
|
+
|
546
|
+
assert_equal(DateTime.new(2005,6,18,15,24,23), TestTimezone.new('Europe/London', nil, [period], dt).local_to_utc(dt))
|
547
|
+
assert_equal(DateTime.new(2005,6,18,15,24,23), TestTimezone.new('Europe/London', nil, [period], dt2).local_to_utc(dt2))
|
548
|
+
assert_equal(Time.utc(2005,6,18,15,24,23), TestTimezone.new('Europe/London', nil, [period], t).local_to_utc(t))
|
549
|
+
assert_equal(Time.utc(2005,6,18,15,24,23), TestTimezone.new('Europe/London', nil, [period], t2).local_to_utc(t2))
|
550
|
+
assert_equal(Time.utc(2005,6,18,15,24,23).to_i, TestTimezone.new('Europe/London', nil, [period], ts).local_to_utc(ts))
|
409
551
|
end
|
410
552
|
|
411
553
|
def test_local_to_utc_offset
|
412
|
-
dt = DateTime.new(2005,
|
413
|
-
dt2 = DateTime.new(2005,
|
414
|
-
t = Time.utc(2005,
|
415
|
-
t2 = Time.local(2005,
|
554
|
+
dt = DateTime.new(2005,6,18,16,24,23)
|
555
|
+
dt2 = DateTime.new(2005,6,18,16,24,23).new_offset(Rational(5,24))
|
556
|
+
t = Time.utc(2005,6,18,16,24,23)
|
557
|
+
t2 = Time.local(2005,6,18,16,24,23)
|
416
558
|
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
559
|
+
o1 = TimezoneOffsetInfo.new(0, 0, :GMT)
|
560
|
+
o2 = TimezoneOffsetInfo.new(0, 3600, :BST)
|
561
|
+
|
562
|
+
period = TimezonePeriod.new(
|
563
|
+
TimezoneTransitionInfo.new(o2, o1, 1111885200),
|
564
|
+
TimezoneTransitionInfo.new(o1, o2, 1130634000))
|
565
|
+
|
566
|
+
assert_equal(0, TestTimezone.new('Europe/London', nil, [period], dt).local_to_utc(dt).offset)
|
567
|
+
assert_equal(0, TestTimezone.new('Europe/London', nil, [period], dt2).local_to_utc(dt2).offset)
|
568
|
+
assert_equal(0, TestTimezone.new('Europe/London', nil, [period], t).local_to_utc(t).utc_offset)
|
569
|
+
assert_equal('UTC', TestTimezone.new('Europe/London', nil, [period], t).local_to_utc(t).zone)
|
570
|
+
assert_equal(0, TestTimezone.new('Europe/London', nil, [period], t2).local_to_utc(t2).utc_offset)
|
571
|
+
assert_equal('UTC', TestTimezone.new('Europe/London', nil, [period], t2).local_to_utc(t2).zone)
|
423
572
|
end
|
424
573
|
|
425
574
|
def test_local_to_utc_invalid
|
426
|
-
|
427
|
-
|
428
|
-
}
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
assert_raise(PeriodNotFound) {
|
433
|
-
|
434
|
-
|
575
|
+
dt = DateTime.new(2004,4,4,2,30,0)
|
576
|
+
tz = TestTimezone.new('America/New_York', nil, [], dt)
|
577
|
+
assert_raise(PeriodNotFound) { tz.local_to_utc(dt) }
|
578
|
+
|
579
|
+
t = Time.utc(2004,4,4,2,30,0)
|
580
|
+
tz = TestTimezone.new('America/New_York', nil, [], t)
|
581
|
+
assert_raise(PeriodNotFound) { tz.local_to_utc(t) }
|
582
|
+
|
583
|
+
i = Time.utc(2004,4,4,2,30,0).to_i
|
584
|
+
tz = TestTimezone.new('America/New_York', nil, [], i)
|
585
|
+
assert_raise(PeriodNotFound) { tz.local_to_utc(i) }
|
435
586
|
end
|
436
587
|
|
437
588
|
def test_local_to_utc_ambiguous
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
589
|
+
o1 = TimezoneOffsetInfo.new(-18000, 0, :EST)
|
590
|
+
o2 = TimezoneOffsetInfo.new(-18000, 3600, :EDT)
|
591
|
+
|
592
|
+
t1 = TimezoneTransitionInfo.new(o2, o1, 1081062000)
|
593
|
+
t2 = TimezoneTransitionInfo.new(o1, o2, 1099202400)
|
594
|
+
t3 = TimezoneTransitionInfo.new(o2, o1, 1112511600)
|
595
|
+
|
596
|
+
p1 = TimezonePeriod.new(t1, t2)
|
597
|
+
p2 = TimezonePeriod.new(t2, t3)
|
598
|
+
|
599
|
+
dt = DateTime.new(2004,10,31,1,30,0)
|
600
|
+
tz = TestTimezone.new('America/New_York', nil, [p1, p2], dt)
|
601
|
+
assert_raise(AmbiguousTime) { tz.local_to_utc(dt) }
|
602
|
+
|
603
|
+
t = Time.utc(2004,10,31,1,30,0)
|
604
|
+
tz = TestTimezone.new('America/New_York', nil, [p1, p2], t)
|
605
|
+
assert_raise(AmbiguousTime) { tz.local_to_utc(t) }
|
606
|
+
|
607
|
+
i = Time.utc(2004,10,31,1,30,0).to_i
|
608
|
+
tz = TestTimezone.new('America/New_York', nil, [p1, p2], i)
|
609
|
+
assert_raise(AmbiguousTime) { tz.local_to_utc(i) }
|
610
|
+
end
|
611
|
+
|
612
|
+
def test_local_to_utc_not_found
|
613
|
+
o1 = TimezoneOffsetInfo.new(-18000, 0, :EST)
|
614
|
+
o2 = TimezoneOffsetInfo.new(-18000, 3600, :EDT)
|
615
|
+
|
616
|
+
t1 = TimezoneTransitionInfo.new(o1, o2, 1067148000)
|
617
|
+
t2 = TimezoneTransitionInfo.new(o2, o1, 1081062000)
|
618
|
+
t3 = TimezoneTransitionInfo.new(o1, o2, 1099202400)
|
619
|
+
|
620
|
+
p1 = TimezonePeriod.new(t1, t2)
|
621
|
+
p2 = TimezonePeriod.new(t2, t3)
|
622
|
+
|
623
|
+
dt = DateTime.new(2004,4,4,2,0,0)
|
624
|
+
t = Time.utc(2004,4,4,2,30,0)
|
625
|
+
i = Time.utc(2004,4,4,2,59,59).to_i
|
626
|
+
|
627
|
+
dt_tz = TestTimezone.new('America/New_York', nil, [], dt)
|
628
|
+
t_tz = TestTimezone.new('America/New_York', nil, [], t)
|
629
|
+
i_tz = TestTimezone.new('America/New_York', nil, [], i)
|
630
|
+
|
631
|
+
assert_raise(PeriodNotFound) { dt_tz.local_to_utc(dt) }
|
632
|
+
assert_raise(PeriodNotFound) { t_tz.local_to_utc(t) }
|
633
|
+
assert_raise(PeriodNotFound) { i_tz.local_to_utc(i) }
|
447
634
|
end
|
448
635
|
|
449
636
|
def test_local_to_utc_dst_flag_resolved
|
450
|
-
|
451
|
-
|
637
|
+
o1 = TimezoneOffsetInfo.new(-18000, 0, :EST)
|
638
|
+
o2 = TimezoneOffsetInfo.new(-18000, 3600, :EDT)
|
452
639
|
|
640
|
+
t1 = TimezoneTransitionInfo.new(o2, o1, 1081062000)
|
641
|
+
t2 = TimezoneTransitionInfo.new(o1, o2, 1099202400)
|
642
|
+
t3 = TimezoneTransitionInfo.new(o2, o1, 1112511600)
|
643
|
+
|
644
|
+
p1 = TimezonePeriod.new(t1, t2)
|
645
|
+
p2 = TimezonePeriod.new(t2, t3)
|
646
|
+
|
647
|
+
dt = DateTime.new(2004,10,31,1,30,0)
|
648
|
+
tz = TestTimezone.new('America/New_York', nil, [p1, p2], dt)
|
649
|
+
|
453
650
|
assert_equal(DateTime.new(2004,10,31,5,30,0), tz.local_to_utc(dt, true))
|
454
651
|
assert_equal(DateTime.new(2004,10,31,6,30,0), tz.local_to_utc(dt, false))
|
455
|
-
assert_equal(DateTime.new(2004,10,31,5,30,0), tz.local_to_utc(dt, true) {|periods| raise
|
456
|
-
assert_equal(DateTime.new(2004,10,31,6,30,0), tz.local_to_utc(dt, false) {|periods| raise
|
652
|
+
assert_equal(DateTime.new(2004,10,31,5,30,0), tz.local_to_utc(dt, true) {|periods| raise BlockCalled, 'should not be called' })
|
653
|
+
assert_equal(DateTime.new(2004,10,31,6,30,0), tz.local_to_utc(dt, false) {|periods| raise BlockCalled, 'should not be called' })
|
457
654
|
end
|
458
655
|
|
459
656
|
def test_local_to_utc_dst_block_called
|
460
|
-
|
461
|
-
|
657
|
+
o1 = TimezoneOffsetInfo.new(-18000, 0, :EST)
|
658
|
+
o2 = TimezoneOffsetInfo.new(-18000, 3600, :EDT)
|
659
|
+
|
660
|
+
t1 = TimezoneTransitionInfo.new(o2, o1, 1081062000)
|
661
|
+
t2 = TimezoneTransitionInfo.new(o1, o2, 1099202400)
|
662
|
+
t3 = TimezoneTransitionInfo.new(o2, o1, 1112511600)
|
462
663
|
|
463
|
-
|
664
|
+
p1 = TimezonePeriod.new(t1, t2)
|
665
|
+
p2 = TimezonePeriod.new(t2, t3)
|
666
|
+
|
667
|
+
dt = DateTime.new(2004,10,31,1,30,0)
|
668
|
+
tz = TestTimezone.new('America/New_York', nil, [p1, p2], dt)
|
669
|
+
|
670
|
+
assert_raise(BlockCalled) {
|
464
671
|
tz.local_to_utc(dt) {|periods|
|
465
|
-
assert_equal(
|
466
|
-
assert_period_for(DateTime.new(2004,4,4,7,0,0), DateTime.new(2004,10,31,6,0,0), true, periods[0])
|
467
|
-
assert_period_for(DateTime.new(2004,10,31,6,0,0), DateTime.new(2005,4,3,7,0,0), false, periods[1])
|
672
|
+
assert_equal([p1, p2], periods)
|
468
673
|
|
469
674
|
# raise exception to test that the block was called
|
470
|
-
raise
|
675
|
+
raise BlockCalled, 'should be raised'
|
471
676
|
}
|
472
677
|
}
|
473
678
|
|
474
679
|
assert_equal(DateTime.new(2004,10,31,5,30,0), tz.local_to_utc(dt) {|periods| periods.first})
|
475
680
|
assert_equal(DateTime.new(2004,10,31,6,30,0), tz.local_to_utc(dt) {|periods| periods.last})
|
681
|
+
assert_equal(DateTime.new(2004,10,31,5,30,0), tz.local_to_utc(dt) {|periods| [periods.first]})
|
682
|
+
assert_equal(DateTime.new(2004,10,31,6,30,0), tz.local_to_utc(dt) {|periods| [periods.last]})
|
476
683
|
end
|
477
684
|
|
478
685
|
def test_local_to_utc_dst_cannot_resolve
|
479
686
|
# At midnight local time on Aug 5 1915 in Warsaw, the clocks were put back
|
480
687
|
# 24 minutes and both periods were non-DST. Hence the block should be
|
481
688
|
# called regardless of the value of the Boolean dst parameter.
|
689
|
+
|
690
|
+
o0 = TimezoneOffsetInfo.new(5040, 0, :LMT)
|
691
|
+
o1 = TimezoneOffsetInfo.new(5040, 0, :WMT)
|
692
|
+
o2 = TimezoneOffsetInfo.new(3600, 0, :CET)
|
693
|
+
o3 = TimezoneOffsetInfo.new(3600, 3600, :CEST)
|
694
|
+
|
695
|
+
t1 = TimezoneTransitionInfo.new(o1, o0, 288925853, 120)
|
696
|
+
t2 = TimezoneTransitionInfo.new(o2, o1, 290485733, 120)
|
697
|
+
t3 = TimezoneTransitionInfo.new(o3, o2, 29051813, 12)
|
698
|
+
|
699
|
+
p1 = TimezonePeriod.new(t1, t2)
|
700
|
+
p2 = TimezonePeriod.new(t2, t3)
|
482
701
|
|
483
702
|
dt = DateTime.new(1915,8,4,23,40,0)
|
484
|
-
tz = Timezone.get('Europe/Warsaw')
|
485
|
-
|
486
|
-
assert_raise(TCTimezoneBlockCalled) {
|
487
|
-
tz.local_to_utc(dt, true) {|periods|
|
488
|
-
assert_equal(2, periods.size)
|
489
|
-
assert_equal(DateTime.new(1915,8,4,22,36,0), periods[0].utc_end)
|
490
|
-
assert_equal(false, periods[0].dst?)
|
491
|
-
assert_period_for(DateTime.new(1915,8,4,22,36,0), DateTime.new(1916,4,30,22,0,0), false, periods[1])
|
492
|
-
|
493
|
-
raise TCTimezoneBlockCalled, 'should be raised'
|
494
|
-
}
|
495
|
-
}
|
496
703
|
|
497
|
-
|
498
|
-
tz.local_to_utc(dt, false) {|periods|
|
499
|
-
assert_equal(2, periods.size)
|
500
|
-
assert_equal(DateTime.new(1915,8,4,22,36,0), periods[0].utc_end)
|
501
|
-
assert_equal(false, periods[0].dst?)
|
502
|
-
assert_period_for(DateTime.new(1915,8,4,22,36,0), DateTime.new(1916,4,30,22,0,0), false, periods[1])
|
704
|
+
tz = TestTimezone.new('Europe/Warsaw', nil, [p1, p2], dt)
|
503
705
|
|
504
|
-
|
505
|
-
|
506
|
-
|
706
|
+
assert_raise(BlockCalled) do
|
707
|
+
tz.local_to_utc(dt, true) do |periods|
|
708
|
+
assert_equal([p1, p2], periods)
|
709
|
+
raise BlockCalled, 'should be raised'
|
710
|
+
end
|
711
|
+
end
|
712
|
+
|
713
|
+
assert_raise(BlockCalled) do
|
714
|
+
tz.local_to_utc(dt, false) do |periods|
|
715
|
+
assert_equal([p1, p2], periods)
|
716
|
+
raise BlockCalled, 'should be raised'
|
717
|
+
end
|
718
|
+
end
|
507
719
|
|
508
720
|
assert_equal(DateTime.new(1915,8,4,22,16,0), tz.local_to_utc(dt) {|periods| periods.first})
|
509
721
|
assert_equal(DateTime.new(1915,8,4,22,40,0), tz.local_to_utc(dt) {|periods| periods.last})
|
722
|
+
assert_equal(DateTime.new(1915,8,4,22,16,0), tz.local_to_utc(dt) {|periods| [periods.first]})
|
723
|
+
assert_equal(DateTime.new(1915,8,4,22,40,0), tz.local_to_utc(dt) {|periods| [periods.last]})
|
510
724
|
end
|
511
725
|
|
512
|
-
def test_local_to_utc_block_ambiguous
|
513
|
-
|
514
|
-
|
726
|
+
def test_local_to_utc_block_ambiguous
|
727
|
+
o1 = TimezoneOffsetInfo.new(-18000, 0, :EST)
|
728
|
+
o2 = TimezoneOffsetInfo.new(-18000, 3600, :EDT)
|
515
729
|
|
516
|
-
|
517
|
-
|
518
|
-
|
730
|
+
t1 = TimezoneTransitionInfo.new(o2, o1, 1081062000)
|
731
|
+
t2 = TimezoneTransitionInfo.new(o1, o2, 1099202400)
|
732
|
+
t3 = TimezoneTransitionInfo.new(o2, o1, 1112511600)
|
519
733
|
|
520
|
-
|
521
|
-
|
522
|
-
}
|
734
|
+
p1 = TimezonePeriod.new(t1, t2)
|
735
|
+
p2 = TimezonePeriod.new(t2, t3)
|
523
736
|
|
524
|
-
|
525
|
-
|
526
|
-
}
|
737
|
+
dt = DateTime.new(2004,10,31,1,30,0)
|
738
|
+
tz = TestTimezone.new('America/New_York', nil, [p1, p2], dt)
|
527
739
|
|
528
|
-
|
529
|
-
|
530
|
-
|
740
|
+
dt = DateTime.new(2004,10,31,1,30,0)
|
741
|
+
tz = Timezone.get('America/New_York')
|
742
|
+
|
743
|
+
assert_raise(AmbiguousTime) { tz.local_to_utc(dt) {|periods| nil} }
|
744
|
+
assert_raise(AmbiguousTime) { tz.local_to_utc(dt) {|periods| periods} }
|
745
|
+
assert_raise(AmbiguousTime) { tz.local_to_utc(dt) {|periods| []} }
|
746
|
+
assert_raise(AmbiguousTime) { tz.local_to_utc(dt) {|periods| raise AmbiguousTime, 'Ambiguous time'} }
|
531
747
|
end
|
532
748
|
|
533
749
|
def test_now
|
@@ -551,67 +767,68 @@ class TCTimezone < Test::Unit::TestCase
|
|
551
767
|
assert_kind_of(Time, current[0])
|
552
768
|
assert_kind_of(TimezonePeriod, current[1])
|
553
769
|
end
|
770
|
+
|
771
|
+
def test_compare
|
772
|
+
assert_equal(0, TestTimezone.new('Europe/London') <=> TestTimezone.new('Europe/London'))
|
773
|
+
assert_equal(-1, TestTimezone.new('Europe/London') <=> TestTimezone.new('Europe/london'))
|
774
|
+
assert_equal(-1, TestTimezone.new('Europe/London') <=> TestTimezone.new('Europe/Paris'))
|
775
|
+
assert_equal(1, TestTimezone.new('Europe/Paris') <=> TestTimezone.new('Europe/London'))
|
776
|
+
assert_equal(-1, TestTimezone.new('America/New_York') <=> TestTimezone.new('Europe/Paris'))
|
777
|
+
assert_equal(1, TestTimezone.new('Europe/Paris') <=> TestTimezone.new('America/New_York'))
|
778
|
+
end
|
554
779
|
|
555
|
-
def
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
assert(Timezone.get('Europe/London') == TimezoneProxy.new('Europe/London'))
|
561
|
-
assert(TimezoneProxy.new('Europe/London') == Timezone.get('Europe/London'))
|
780
|
+
def test_equality
|
781
|
+
assert_equal(true, TestTimezone.new('Europe/London') == TestTimezone.new('Europe/London'))
|
782
|
+
assert_equal(false, TestTimezone.new('Europe/London') == TestTimezone.new('Europe/london'))
|
783
|
+
assert_equal(false, TestTimezone.new('Europe/London') == TestTimezone.new('Europe/Paris'))
|
784
|
+
assert_nil(TestTimezone.new('Europe/London') == Object.new)
|
562
785
|
end
|
563
786
|
|
564
|
-
def
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
assert_equal(0, Timezone.get('Europe/London') <=> Definitions::Europe::London.new)
|
570
|
-
assert_equal(0, Definitions::Europe::London.new <=> Timezone.get('Europe/London'))
|
571
|
-
assert_equal(0, Timezone.get('Europe/London') <=> Timezone.get('Europe/London'))
|
572
|
-
assert((Timezone.get('Europe/London') <=> Timezone.get('Europe/Paris')) < 0)
|
573
|
-
assert((Timezone.get('Europe/Paris') <=> Timezone.get('Europe/London')) > 0)
|
574
|
-
assert((Timezone.get('America/New_York') <=> Timezone.get('Europe/Paris')) < 0)
|
575
|
-
assert((Timezone.get('Europe/Paris') <=> Timezone.get('America/New_York')) > 0)
|
576
|
-
end
|
577
|
-
|
578
|
-
# Identifier for the parent zone was getting set to the identifier of the
|
579
|
-
# last linked zone to be loaded. See bug #4502.
|
580
|
-
def test_linked_identifier
|
581
|
-
zones = ['Europe/Belgrade', 'Europe/Ljubljana', 'Europe/Sarajevo',
|
582
|
-
'Europe/Skopje', 'Europe/Zagreb']
|
583
|
-
zones = zones + zones.reverse
|
584
|
-
|
585
|
-
zones.each {|z| assert_equal(z, Timezone.get(z).identifier)}
|
586
|
-
end
|
587
|
-
|
588
|
-
# When requesting a linked zone, an instance of the parent zone was being
|
589
|
-
# returned. See the first comment in bug #4502.
|
590
|
-
def test_linked_class
|
591
|
-
zones = ['Europe/Belgrade', 'Europe/Ljubljana', 'Europe/Sarajevo',
|
592
|
-
'Europe/Skopje', 'Europe/Zagreb']
|
593
|
-
zones = zones + zones.reverse
|
594
|
-
|
595
|
-
zones.each {|z|
|
596
|
-
assert_equal("TZInfo::Definitions::#{z.sub(/\//, '::')}",
|
597
|
-
Timezone.get(z).class.name)
|
598
|
-
}
|
787
|
+
def test_eql
|
788
|
+
assert_equal(true, TestTimezone.new('Europe/London').eql?(TestTimezone.new('Europe/London')))
|
789
|
+
assert_equal(false, TestTimezone.new('Europe/London').eql?(TestTimezone.new('Europe/london')))
|
790
|
+
assert_equal(false, TestTimezone.new('Europe/London').eql?(TestTimezone.new('Europe/Paris')))
|
791
|
+
assert_nil(TestTimezone.new('Europe/London') == Object.new)
|
599
792
|
end
|
600
|
-
|
601
|
-
def
|
602
|
-
|
603
|
-
|
604
|
-
zones = zones + zones.reverse
|
605
|
-
|
606
|
-
zones.each {|z|
|
607
|
-
assert_equal(Timezone.get(z).class, Timezone.get(z).class.instance.class)
|
608
|
-
}
|
793
|
+
|
794
|
+
def test_hash
|
795
|
+
assert_equal('Europe/London'.hash, TestTimezone.new('Europe/London').hash)
|
796
|
+
assert_equal('America/New_York'.hash, TestTimezone.new('America/New_York').hash)
|
609
797
|
end
|
610
798
|
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
799
|
+
def test_marshal_data
|
800
|
+
tz = Timezone.get('Europe/London')
|
801
|
+
assert_kind_of(DataTimezone, tz)
|
802
|
+
assert_same(tz, Marshal.load(Marshal.dump(tz)))
|
803
|
+
end
|
804
|
+
|
805
|
+
def test_marshal_linked
|
806
|
+
tz = Timezone.get('UTC')
|
807
|
+
assert_kind_of(LinkedTimezone, tz)
|
808
|
+
assert_same(tz, Marshal.load(Marshal.dump(tz)))
|
809
|
+
end
|
810
|
+
|
811
|
+
def test_strftime_datetime
|
812
|
+
tz = Timezone.get('Europe/London')
|
813
|
+
assert_equal('23:12:02 BST', tz.strftime('%H:%M:%S %Z', DateTime.new(1965, 7, 15, 22, 12, 2)))
|
814
|
+
assert_equal('BST', tz.strftime('%Z', DateTime.new(1965, 7, 15, 22, 12, 2)))
|
815
|
+
assert_equal('%ZBST', tz.strftime('%%Z%Z', DateTime.new(1965, 7, 15, 22, 12, 2)))
|
816
|
+
assert_equal('BST BST', tz.strftime('%Z %Z', DateTime.new(1965, 7, 15, 22, 12, 2)))
|
817
|
+
end
|
818
|
+
|
819
|
+
def test_strftime_time
|
820
|
+
tz = Timezone.get('Europe/London')
|
821
|
+
assert_equal('23:12:02 BST', tz.strftime('%H:%M:%S %Z', Time.utc(2006, 7, 15, 22, 12, 2)))
|
822
|
+
assert_equal('BST', tz.strftime('%Z', Time.utc(2006, 7, 15, 22, 12, 2)))
|
823
|
+
assert_equal('%ZBST', tz.strftime('%%Z%Z', Time.utc(2006, 7, 15, 22, 12, 2)))
|
824
|
+
assert_equal('BST BST', tz.strftime('%Z %Z', Time.utc(2006, 7, 15, 22, 12, 2)))
|
825
|
+
end
|
826
|
+
|
827
|
+
def test_strftime_int
|
828
|
+
tz = Timezone.get('Europe/London')
|
829
|
+
assert_equal('23:12:02 BST', tz.strftime('%H:%M:%S %Z', Time.utc(2006, 7, 15, 22, 12, 2).to_i))
|
830
|
+
assert_equal('BST', tz.strftime('%Z', Time.utc(2006, 7, 15, 22, 12, 2).to_i))
|
831
|
+
assert_equal('%ZBST', tz.strftime('%%Z%Z', Time.utc(2006, 7, 15, 22, 12, 2).to_i))
|
832
|
+
assert_equal('BST BST', tz.strftime('%Z %Z', Time.utc(2006, 7, 15, 22, 12, 2).to_i))
|
833
|
+
end
|
617
834
|
end
|