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/lib/tzinfo/countries/YE.rb
DELETED
data/lib/tzinfo/countries/YT.rb
DELETED
data/lib/tzinfo/countries/ZA.rb
DELETED
data/lib/tzinfo/countries/ZM.rb
DELETED
data/lib/tzinfo/countries/ZW.rb
DELETED
@@ -1,234 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright (c) 2005-2006 Philip Ross
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
# of this software and associated documentation files (the "Software"), to deal
|
6
|
-
# in the Software without restriction, including without limitation the rights
|
7
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the Software is
|
9
|
-
# furnished to do so, subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in all
|
12
|
-
# copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
-
# THE SOFTWARE.
|
21
|
-
#++
|
22
|
-
|
23
|
-
require 'tzinfo/time_or_datetime'
|
24
|
-
require 'tzinfo/timezone_period'
|
25
|
-
|
26
|
-
module TZInfo
|
27
|
-
# Thrown to indicate that no TimezonePeriod matching a given time could be found.
|
28
|
-
class PeriodNotFound < StandardError
|
29
|
-
end
|
30
|
-
|
31
|
-
# A list of TimezonePeriod instances defining a Timezone.
|
32
|
-
class TimezonePeriodList
|
33
|
-
# Initializes a new TimezonePeriodList
|
34
|
-
def initialize
|
35
|
-
@list = nil
|
36
|
-
@last_year = nil
|
37
|
-
@last_month = nil
|
38
|
-
@start_year = nil
|
39
|
-
@start_month = nil
|
40
|
-
@unbounded_start = nil
|
41
|
-
end
|
42
|
-
|
43
|
-
# One unbounded start period can be defined. This must be set before any
|
44
|
-
# calls to add.
|
45
|
-
#
|
46
|
-
# ArgumentError will be thrown if add or add_unbounded_start has already
|
47
|
-
# been called.
|
48
|
-
def add_unbounded_start(&block)
|
49
|
-
raise ArgumentError, 'add_unbounded_start has already been called' if !@unbounded_start.nil?
|
50
|
-
raise ArgumentError, 'add has already been called' if !@list.nil?
|
51
|
-
@unbounded_start = block
|
52
|
-
end
|
53
|
-
|
54
|
-
# Adds a new TimezonePeriod to the list. utc_start_year and utc_start_month
|
55
|
-
# are the year and month in which the period starts in UTC. A block must
|
56
|
-
# be passed in that will return the TimezonePeriod when called with no
|
57
|
-
# arguments.
|
58
|
-
#
|
59
|
-
# If the start year and month are less than the previously encountered
|
60
|
-
# year and month ArgumentError will be thrown.
|
61
|
-
#
|
62
|
-
# Blocks must be added in order of increasing UTC start date.
|
63
|
-
def add(utc_start_year, utc_start_month, &block)
|
64
|
-
if @list.nil?
|
65
|
-
@list = [block]
|
66
|
-
@start_year = utc_start_year
|
67
|
-
@start_month = utc_start_month
|
68
|
-
else
|
69
|
-
if utc_start_year < @last_year || (utc_start_year == @last_year && utc_start_month < @last_month)
|
70
|
-
raise ArgumentError, 'Calls to add must be in increasing start date order'
|
71
|
-
end
|
72
|
-
|
73
|
-
index = index_for_utc(utc_start_year, utc_start_month)
|
74
|
-
if @list[index].nil?
|
75
|
-
@list[index] = block
|
76
|
-
elsif @list[index].is_a?(Array)
|
77
|
-
@list[index] << block
|
78
|
-
else
|
79
|
-
@list[index] = [@list[index], block]
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
@last_year = utc_start_year
|
84
|
-
@last_month = utc_start_month
|
85
|
-
end
|
86
|
-
|
87
|
-
# Returns the period for the given utc time.
|
88
|
-
# If no period is found for the given time, PeriodNotFound is thrown.
|
89
|
-
def period_for_utc(utc)
|
90
|
-
utc = TimeOrDateTime.wrap(utc)
|
91
|
-
|
92
|
-
if @list.nil?
|
93
|
-
result = nil
|
94
|
-
else
|
95
|
-
index = index_for_utc(utc.year, utc.mon)
|
96
|
-
index = 0 if index < 0
|
97
|
-
index = @list.length - 1 if index >= @list.length
|
98
|
-
|
99
|
-
result = nil
|
100
|
-
index.downto(0) {|i|
|
101
|
-
contents = get_contents(i)
|
102
|
-
|
103
|
-
if contents.is_a?(Array)
|
104
|
-
(contents.length - 1).downto(0) {|j|
|
105
|
-
if contents[j].valid_for_utc?(utc)
|
106
|
-
result = contents[j]
|
107
|
-
break
|
108
|
-
end
|
109
|
-
}
|
110
|
-
break unless result.nil?
|
111
|
-
elsif !contents.nil? && contents.valid_for_utc?(utc)
|
112
|
-
result = contents
|
113
|
-
break
|
114
|
-
end
|
115
|
-
}
|
116
|
-
end
|
117
|
-
|
118
|
-
if result.nil?
|
119
|
-
unbounded_start = get_unbounded_start
|
120
|
-
if !unbounded_start.nil? && unbounded_start.valid_for_utc?(utc)
|
121
|
-
unbounded_start
|
122
|
-
else
|
123
|
-
raise PeriodNotFound, "No period found for utc: #{utc}"
|
124
|
-
end
|
125
|
-
else
|
126
|
-
result
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
# Returns the set of periods for the given local time as an array.
|
131
|
-
# If no period is found for the given time, PeriodNotFound is thrown.
|
132
|
-
# Results returned are ordered by increasing UTC start date.
|
133
|
-
def periods_for_local(local)
|
134
|
-
local = TimeOrDateTime.wrap(local)
|
135
|
-
|
136
|
-
# found_first is used to avoid searching back to far
|
137
|
-
# the search will be limited at the next half year block after discovering
|
138
|
-
# the first match
|
139
|
-
found_first = nil
|
140
|
-
|
141
|
-
result = []
|
142
|
-
|
143
|
-
if !@list.nil?
|
144
|
-
# add one to the index because the periods are indexed by UTC start
|
145
|
-
# and the period we are looking for could therefore be in the next
|
146
|
-
# half of the year
|
147
|
-
index = index_for_utc(local.year, local.mon) + 1
|
148
|
-
index = 0 if index < 0
|
149
|
-
index = @list.length - 1 if index >= @list.length
|
150
|
-
|
151
|
-
index.downto(0) {|i|
|
152
|
-
contents = get_contents(i)
|
153
|
-
|
154
|
-
if contents.is_a?(Array)
|
155
|
-
(contents.length - 1).downto(0) {|j|
|
156
|
-
if contents[j].valid_for_local?(local)
|
157
|
-
result << contents[j]
|
158
|
-
found_first = i if found_first.nil?
|
159
|
-
end
|
160
|
-
}
|
161
|
-
elsif !contents.nil? && contents.valid_for_local?(local)
|
162
|
-
result << contents
|
163
|
-
found_first = i if found_first.nil?
|
164
|
-
end
|
165
|
-
|
166
|
-
if !contents.nil? && !found_first.nil? && i < found_first
|
167
|
-
# searched far enough
|
168
|
-
break
|
169
|
-
end
|
170
|
-
}
|
171
|
-
end
|
172
|
-
|
173
|
-
if result.empty? || found_first == 0
|
174
|
-
unbounded_start = get_unbounded_start
|
175
|
-
result << unbounded_start if !unbounded_start.nil? && unbounded_start.valid_for_local?(local)
|
176
|
-
end
|
177
|
-
|
178
|
-
if result.empty?
|
179
|
-
raise PeriodNotFound, "No period found for utc: #{local}"
|
180
|
-
else
|
181
|
-
result.reverse!
|
182
|
-
result
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
private
|
187
|
-
# Returns the index into the @list array for a given utc year and month.
|
188
|
-
def index_for_utc(year, month)
|
189
|
-
index = (year - @start_year) * 2
|
190
|
-
index += 1 if month > 6
|
191
|
-
index -= 1 if @start_month > 6
|
192
|
-
index
|
193
|
-
end
|
194
|
-
|
195
|
-
# Returns the contents of any 6 month period, expanding any blocks to
|
196
|
-
# TimezonePeriods first.
|
197
|
-
def get_contents(index)
|
198
|
-
contents = @list[index]
|
199
|
-
if contents.nil?
|
200
|
-
nil
|
201
|
-
elsif contents.is_a?(TimezonePeriod)
|
202
|
-
contents
|
203
|
-
elsif contents.is_a?(Array)
|
204
|
-
if contents.first.is_a?(TimezonePeriod)
|
205
|
-
contents
|
206
|
-
else
|
207
|
-
contents = contents.collect {|proc|
|
208
|
-
proc.call
|
209
|
-
}
|
210
|
-
@list[index] = contents
|
211
|
-
contents
|
212
|
-
end
|
213
|
-
elsif contents.is_a?(Proc)
|
214
|
-
contents = contents.call
|
215
|
-
@list[index] = contents
|
216
|
-
contents
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
220
|
-
# Expands unbounded_start if it is defined.
|
221
|
-
def get_unbounded_start
|
222
|
-
contents = @unbounded_start
|
223
|
-
if contents.nil?
|
224
|
-
nil
|
225
|
-
elsif contents.is_a?(TimezonePeriod)
|
226
|
-
contents
|
227
|
-
else
|
228
|
-
contents = contents.call
|
229
|
-
@unbounded_start = contents
|
230
|
-
contents
|
231
|
-
end
|
232
|
-
end
|
233
|
-
end
|
234
|
-
end
|
@@ -1,310 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
2
|
-
require 'test/unit'
|
3
|
-
require 'tzinfo/timezone_period_list'
|
4
|
-
|
5
|
-
include TZInfo
|
6
|
-
|
7
|
-
class TCTimezonePeriod < Test::Unit::TestCase
|
8
|
-
def test_add
|
9
|
-
# Just a test for no exception
|
10
|
-
|
11
|
-
list = TimezonePeriodList.new
|
12
|
-
list.add(2005, 1) { TimezonePeriod.new(DateTime.new(2005,1,1,1,0,0), DateTime.new(2005,3,1,1,0,0), 0, 0, :TEST) }
|
13
|
-
list.add(2005, 3) { TimezonePeriod.new(DateTime.new(2005,3,1,1,0,0), DateTime.new(2005,5,1,1,0,0), 0, 0, :TEST) }
|
14
|
-
list.add(2005, 5) { TimezonePeriod.new(DateTime.new(2005,5,1,1,0,0), DateTime.new(2005,5,2,1,0,0), 0, 0, :TEST) }
|
15
|
-
list.add(2005, 5) { TimezonePeriod.new(DateTime.new(2005,5,2,1,0,0), DateTime.new(2005,7,1,1,0,0), 0, 0, :TEST) }
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_add_incorrect_order
|
19
|
-
list = TimezonePeriodList.new
|
20
|
-
list.add(2005, 1) { TimezonePeriod.new(DateTime.new(2005,1,1,1,0,0), DateTime.new(2005,2,1,1,0,0), 0, 0, :TEST) }
|
21
|
-
list.add(2005, 3) { TimezonePeriod.new(DateTime.new(2005,3,1,1,0,0), DateTime.new(2005,5,1,1,0,0), 0, 0, :TEST) }
|
22
|
-
|
23
|
-
assert_raise(ArgumentError) {
|
24
|
-
list.add(2005, 2) { TimezonePeriod.new(DateTime.new(2005,2,1,1,0,0), DateTime.new(2005,3,1,1,0,0), 0, 0, :TEST) }
|
25
|
-
}
|
26
|
-
|
27
|
-
assert_raise(ArgumentError) {
|
28
|
-
list.add(2004, 12) { TimezonePeriod.new(DateTime.new(2004,12,1,1,0,0), DateTime.new(2005,1,1,1,0,0), 0, 0, :TEST) }
|
29
|
-
}
|
30
|
-
|
31
|
-
assert_raise(ArgumentError) {
|
32
|
-
list.add_unbounded_start { TimezonePeriod.new(nil, DateTime.new(2005,1,1,1,0,0), 0, 0, :TEST) }
|
33
|
-
}
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_add_incorrect_order_unbounded
|
37
|
-
list = TimezonePeriodList.new
|
38
|
-
list.add_unbounded_start { TimezonePeriod.new(nil, DateTime.new(2005,1,1,1,0,0), 0, 0, :TEST) }
|
39
|
-
|
40
|
-
assert_raise(ArgumentError) {
|
41
|
-
list.add_unbounded_start { TimezonePeriod.new(nil, DateTime.new(2005,1,1,1,0,0), 0, 0, :TEST) }
|
42
|
-
}
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_period_for_utc
|
46
|
-
list = TimezonePeriodList.new
|
47
|
-
list.add(2000, 4) { TimezonePeriod.new(DateTime.new(2000,4,1,1,0,0),DateTime.new(2000,10,1,1,0,0),-18000,3600,:'TESTD') }
|
48
|
-
list.add(2000, 10) { TimezonePeriod.new(DateTime.new(2000,10,1,1,0,0),DateTime.new(2001,3,1,1,0,0),-18000,0,:'TESTS') }
|
49
|
-
list.add(2001, 3) { TimezonePeriod.new(DateTime.new(2001,3,1,1,0,0),DateTime.new(2001,4,1,1,0,0),-18000,3600,:'TESTD') }
|
50
|
-
list.add(2001, 4) { TimezonePeriod.new(DateTime.new(2001,4,1,1,0,0),DateTime.new(2001,10,1,1,0,0),-21600,3600,:'TESTD') }
|
51
|
-
list.add(2001, 10) { TimezonePeriod.new(DateTime.new(2001,10,1,1,0,0),DateTime.new(2002,10,1,1,0,0),-18000,0,:'TESTS') }
|
52
|
-
list.add(2002, 10) { TimezonePeriod.new(DateTime.new(2002,10,1,1,0,0),DateTime.new(2003,2,1,1,0,0),-18000,0,:'TESTS') }
|
53
|
-
|
54
|
-
# TimezonePeriodList expands out blocks and caches the results
|
55
|
-
# run twice to ensure this is being done correctly
|
56
|
-
2.times {|i|
|
57
|
-
assert_raise(PeriodNotFound) {
|
58
|
-
list.period_for_utc(DateTime.new(1999,12,1,0,0,0))
|
59
|
-
}
|
60
|
-
assert_raise(PeriodNotFound) {
|
61
|
-
list.period_for_utc(DateTime.new(2000,4,1,0,59,59))
|
62
|
-
}
|
63
|
-
assert_period_equal(TimezonePeriod.new(DateTime.new(2000,4,1,1,0,0),DateTime.new(2000,10,1,1,0,0),-18000,3600,:'TESTD'),
|
64
|
-
list.period_for_utc(DateTime.new(2000,4,1,1,0,0)))
|
65
|
-
assert_period_equal(TimezonePeriod.new(DateTime.new(2000,4,1,1,0,0),DateTime.new(2000,10,1,1,0,0),-18000,3600,:'TESTD'),
|
66
|
-
list.period_for_utc(DateTime.new(2000,10,1,0,59,59)))
|
67
|
-
assert_period_equal(TimezonePeriod.new(DateTime.new(2000,10,1,1,0,0),DateTime.new(2001,3,1,1,0,0),-18000,0,:'TESTS'),
|
68
|
-
list.period_for_utc(DateTime.new(2000,10,1,1,0,0)))
|
69
|
-
assert_period_equal(TimezonePeriod.new(DateTime.new(2000,10,1,1,0,0),DateTime.new(2001,3,1,1,0,0),-18000,0,:'TESTS'),
|
70
|
-
list.period_for_utc(DateTime.new(2001,3,1,0,59,59)))
|
71
|
-
assert_period_equal(TimezonePeriod.new(DateTime.new(2001,3,1,1,0,0),DateTime.new(2001,4,1,1,0,0),-18000,3600,:'TESTD'),
|
72
|
-
list.period_for_utc(DateTime.new(2001,3,1,1,0,0)))
|
73
|
-
assert_period_equal(TimezonePeriod.new(DateTime.new(2001,3,1,1,0,0),DateTime.new(2001,4,1,1,0,0),-18000,3600,:'TESTD'),
|
74
|
-
list.period_for_utc(DateTime.new(2001,4,1,0,59,59)))
|
75
|
-
assert_period_equal(TimezonePeriod.new(DateTime.new(2001,4,1,1,0,0),DateTime.new(2001,10,1,1,0,0),-21600,3600,:'TESTD'),
|
76
|
-
list.period_for_utc(DateTime.new(2001,4,1,1,0,0)))
|
77
|
-
assert_period_equal(TimezonePeriod.new(DateTime.new(2001,4,1,1,0,0),DateTime.new(2001,10,1,1,0,0),-21600,3600,:'TESTD'),
|
78
|
-
list.period_for_utc(DateTime.new(2001,10,1,0,59,59)))
|
79
|
-
assert_period_equal(TimezonePeriod.new(DateTime.new(2001,10,1,1,0,0),DateTime.new(2002,10,1,1,0,0),-18000,0,:'TESTS'),
|
80
|
-
list.period_for_utc(DateTime.new(2001,10,1,1,0,0)))
|
81
|
-
assert_period_equal(TimezonePeriod.new(DateTime.new(2001,10,1,1,0,0),DateTime.new(2002,10,1,1,0,0),-18000,0,:'TESTS'),
|
82
|
-
list.period_for_utc(DateTime.new(2002,2,1,1,0,0)))
|
83
|
-
assert_period_equal(TimezonePeriod.new(DateTime.new(2001,10,1,1,0,0),DateTime.new(2002,10,1,1,0,0),-18000,0,:'TESTS'),
|
84
|
-
list.period_for_utc(DateTime.new(2002,10,1,0,59,59)))
|
85
|
-
assert_period_equal(TimezonePeriod.new(DateTime.new(2002,10,1,1,0,0),DateTime.new(2003,2,1,1,0,0),-18000,0,:'TESTS'),
|
86
|
-
list.period_for_utc(DateTime.new(2002,10,1,1,0,0)))
|
87
|
-
assert_period_equal(TimezonePeriod.new(DateTime.new(2002,10,1,1,0,0),DateTime.new(2003,2,1,1,0,0),-18000,0,:'TESTS'),
|
88
|
-
list.period_for_utc(DateTime.new(2003,2,1,0,59,59)))
|
89
|
-
|
90
|
-
assert_raise(PeriodNotFound) {
|
91
|
-
list.period_for_utc(DateTime.new(2003,2,1,1,0,0))
|
92
|
-
}
|
93
|
-
assert_raise(PeriodNotFound) {
|
94
|
-
list.period_for_utc(DateTime.new(2004,1,1,1,0,0))
|
95
|
-
}
|
96
|
-
}
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_period_for_utc_unbounded
|
100
|
-
list = TimezonePeriodList.new
|
101
|
-
list.add_unbounded_start { TimezonePeriod.new(nil,DateTime.new(2000,10,1,1,0,0),-18000,3600,:'TESTD') }
|
102
|
-
list.add(2000, 10) { TimezonePeriod.new(DateTime.new(2000,10,1,1,0,0),DateTime.new(2001,3,1,1,0,0),-18000,0,:'TESTS') }
|
103
|
-
list.add(2001, 3) { TimezonePeriod.new(DateTime.new(2001,3,1,1,0,0),nil,-18000,3600,:'TESTD') }
|
104
|
-
|
105
|
-
assert_period_equal(TimezonePeriod.new(nil,DateTime.new(2000,10,1,1,0,0),-18000,3600,:'TESTD'),
|
106
|
-
list.period_for_utc(DateTime.new(1999,12,1,1,0,0)))
|
107
|
-
assert_period_equal(TimezonePeriod.new(nil,DateTime.new(2000,10,1,1,0,0),-18000,3600,:'TESTD'),
|
108
|
-
list.period_for_utc(DateTime.new(2000,10,1,0,59,59)))
|
109
|
-
assert_period_equal(TimezonePeriod.new(DateTime.new(2000,10,1,1,0,0),DateTime.new(2001,3,1,1,0,0),-18000,0,:'TESTS'),
|
110
|
-
list.period_for_utc(DateTime.new(2000,10,1,1,0,0)))
|
111
|
-
assert_period_equal(TimezonePeriod.new(DateTime.new(2000,10,1,1,0,0),DateTime.new(2001,3,1,1,0,0),-18000,0,:'TESTS'),
|
112
|
-
list.period_for_utc(DateTime.new(2001,3,1,0,59,59)))
|
113
|
-
assert_period_equal(TimezonePeriod.new(DateTime.new(2001,3,1,1,0,0),nil,-18000,3600,:'TESTD'),
|
114
|
-
list.period_for_utc(DateTime.new(2001,3,1,1,0,0)))
|
115
|
-
assert_period_equal(TimezonePeriod.new(DateTime.new(2001,3,1,1,0,0),nil,-18000,3600,:'TESTD'),
|
116
|
-
list.period_for_utc(DateTime.new(2002,1,1,1,0,0)))
|
117
|
-
end
|
118
|
-
|
119
|
-
def test_period_for_utc_gap
|
120
|
-
list = TimezonePeriodList.new
|
121
|
-
list.add(2000, 4) { TimezonePeriod.new(DateTime.new(2000,4,1,1,0,0),DateTime.new(2000,5,1,1,0,0),-18000,3600,:'TESTD') }
|
122
|
-
list.add(2000, 10) { TimezonePeriod.new(DateTime.new(2000,10,1,1,0,0),DateTime.new(2001,3,1,1,0,0),-18000,0,:'TESTS') }
|
123
|
-
|
124
|
-
assert_raise(PeriodNotFound) {
|
125
|
-
list.period_for_utc(DateTime.new(2005,5,1,1,0,0))
|
126
|
-
}
|
127
|
-
|
128
|
-
assert_raise(PeriodNotFound) {
|
129
|
-
list.period_for_utc(DateTime.new(2005,10,1,0,59,59))
|
130
|
-
}
|
131
|
-
end
|
132
|
-
|
133
|
-
def test_period_for_utc_empty
|
134
|
-
list = TimezonePeriodList.new
|
135
|
-
assert_raise(PeriodNotFound) {
|
136
|
-
list.period_for_utc(DateTime.new(2005,1,1,0,0,0))
|
137
|
-
}
|
138
|
-
end
|
139
|
-
|
140
|
-
def test_periods_for_local
|
141
|
-
list = TimezonePeriodList.new
|
142
|
-
list.add(2000, 4) { TimezonePeriod.new(DateTime.new(2000,4,2,1,0,0),DateTime.new(2000,10,2,1,0,0),-18000,3600,:'TESTD') }
|
143
|
-
list.add(2000, 10) { TimezonePeriod.new(DateTime.new(2000,10,2,1,0,0),DateTime.new(2001,3,2,1,0,0),-18000,0,:'TESTS') }
|
144
|
-
list.add(2001, 3) { TimezonePeriod.new(DateTime.new(2001,3,2,1,0,0),DateTime.new(2001,4,2,1,0,0),-18000,3600,:'TESTD') }
|
145
|
-
list.add(2001, 4) { TimezonePeriod.new(DateTime.new(2001,4,2,1,0,0),DateTime.new(2001,10,2,1,0,0),-21600,3600,:'TESTD') }
|
146
|
-
list.add(2001, 10) { TimezonePeriod.new(DateTime.new(2001,10,2,1,0,0),DateTime.new(2002,10,2,1,0,0),-18000,0,:'TESTS') }
|
147
|
-
list.add(2002, 10) { TimezonePeriod.new(DateTime.new(2002,10,2,1,0,0),DateTime.new(2003,2,2,1,0,0),-18000,0,:'TESTS') }
|
148
|
-
|
149
|
-
# TimezonePeriodList expands out blocks and caches the results
|
150
|
-
# run twice to ensure this is being done correctly
|
151
|
-
2.times {|i|
|
152
|
-
assert_raise(PeriodNotFound) {
|
153
|
-
list.periods_for_local(DateTime.new(1999,12,1,0,0,0))
|
154
|
-
}
|
155
|
-
assert_raise(PeriodNotFound) {
|
156
|
-
list.periods_for_local(DateTime.new(2000,4,1,20,59,59))
|
157
|
-
}
|
158
|
-
|
159
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2000,4,2,1,0,0),DateTime.new(2000,10,2,1,0,0),-18000,3600,:'TESTD')],
|
160
|
-
list.periods_for_local(DateTime.new(2000,4,1,21,0,0)))
|
161
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2000,4,2,1,0,0),DateTime.new(2000,10,2,1,0,0),-18000,3600,:'TESTD')],
|
162
|
-
list.periods_for_local(DateTime.new(2000,10,1,19,59,59)))
|
163
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2000,4,2,1,0,0),DateTime.new(2000,10,2,1,0,0),-18000,3600,:'TESTD'),
|
164
|
-
TimezonePeriod.new(DateTime.new(2000,10,2,1,0,0),DateTime.new(2001,3,2,1,0,0),-18000,0,:'TESTS')],
|
165
|
-
list.periods_for_local(DateTime.new(2000,10,1,20,0,0)))
|
166
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2000,4,2,1,0,0),DateTime.new(2000,10,2,1,0,0),-18000,3600,:'TESTD'),
|
167
|
-
TimezonePeriod.new(DateTime.new(2000,10,2,1,0,0),DateTime.new(2001,3,2,1,0,0),-18000,0,:'TESTS')],
|
168
|
-
list.periods_for_local(DateTime.new(2000,10,1,20,59,59)))
|
169
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2000,10,2,1,0,0),DateTime.new(2001,3,2,1,0,0),-18000,0,:'TESTS')],
|
170
|
-
list.periods_for_local(DateTime.new(2000,10,1,21,0,0)))
|
171
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2000,10,2,1,0,0),DateTime.new(2001,3,2,1,0,0),-18000,0,:'TESTS')],
|
172
|
-
list.periods_for_local(DateTime.new(2001,3,1,19,59,59)))
|
173
|
-
|
174
|
-
assert_raise(PeriodNotFound) {
|
175
|
-
list.periods_for_local(DateTime.new(2001,3,1,20,0,0))
|
176
|
-
}
|
177
|
-
assert_raise(PeriodNotFound) {
|
178
|
-
list.periods_for_local(DateTime.new(2001,3,1,20,59,59))
|
179
|
-
}
|
180
|
-
|
181
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2001,3,2,1,0,0),DateTime.new(2001,4,2,1,0,0),-18000,3600,:'TESTD')],
|
182
|
-
list.periods_for_local(DateTime.new(2001,3,1,21,0,0)))
|
183
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2001,3,2,1,0,0),DateTime.new(2001,4,2,1,0,0),-18000,3600,:'TESTD')],
|
184
|
-
list.periods_for_local(DateTime.new(2001,4,1,19,59,59)))
|
185
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2001,3,2,1,0,0),DateTime.new(2001,4,2,1,0,0),-18000,3600,:'TESTD'),
|
186
|
-
TimezonePeriod.new(DateTime.new(2001,4,2,1,0,0),DateTime.new(2001,10,2,1,0,0),-21600,3600,:'TESTD')],
|
187
|
-
list.periods_for_local(DateTime.new(2001,4,1,20,0,0)))
|
188
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2001,3,2,1,0,0),DateTime.new(2001,4,2,1,0,0),-18000,3600,:'TESTD'),
|
189
|
-
TimezonePeriod.new(DateTime.new(2001,4,2,1,0,0),DateTime.new(2001,10,2,1,0,0),-21600,3600,:'TESTD')],
|
190
|
-
list.periods_for_local(DateTime.new(2001,4,1,20,59,59)))
|
191
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2001,4,2,1,0,0),DateTime.new(2001,10,2,1,0,0),-21600,3600,:'TESTD')],
|
192
|
-
list.periods_for_local(DateTime.new(2001,4,1,21,0,0)))
|
193
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2001,4,2,1,0,0),DateTime.new(2001,10,2,1,0,0),-21600,3600,:'TESTD')],
|
194
|
-
list.periods_for_local(DateTime.new(2001,10,1,19,59,59)))
|
195
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2001,10,2,1,0,0),DateTime.new(2002,10,2,1,0,0),-18000,0,:'TESTS')],
|
196
|
-
list.periods_for_local(DateTime.new(2001,10,1,20,0,0)))
|
197
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2001,10,2,1,0,0),DateTime.new(2002,10,2,1,0,0),-18000,0,:'TESTS')],
|
198
|
-
list.periods_for_local(DateTime.new(2002,2,1,20,0,0)))
|
199
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2001,10,2,1,0,0),DateTime.new(2002,10,2,1,0,0),-18000,0,:'TESTS')],
|
200
|
-
list.periods_for_local(DateTime.new(2002,10,1,19,59,59)))
|
201
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2002,10,2,1,0,0),DateTime.new(2003,2,2,1,0,0),-18000,0,:'TESTS')],
|
202
|
-
list.periods_for_local(DateTime.new(2002,10,1,20,0,0)))
|
203
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2002,10,2,1,0,0),DateTime.new(2003,2,2,1,0,0),-18000,0,:'TESTS')],
|
204
|
-
list.periods_for_local(DateTime.new(2003,2,1,19,59,59)))
|
205
|
-
|
206
|
-
assert_raise(PeriodNotFound) {
|
207
|
-
list.periods_for_local(DateTime.new(2003,2,1,20,0,0))
|
208
|
-
}
|
209
|
-
assert_raise(PeriodNotFound) {
|
210
|
-
list.periods_for_local(DateTime.new(2004,1,1,20,0,0))
|
211
|
-
}
|
212
|
-
}
|
213
|
-
end
|
214
|
-
|
215
|
-
def test_periods_for_local_warsaw
|
216
|
-
list = TimezonePeriodList.new
|
217
|
-
list.add_unbounded_start {TimezonePeriod.new(nil,DateTime.new(1879,12,31,22,36,0),5040,0,:LMT)}
|
218
|
-
list.add(1879,12) {TimezonePeriod.new(DateTime.new(1879,12,31,22,36,0),DateTime.new(1915,8,4,22,36,0),5040,0,:WMT)}
|
219
|
-
list.add(1915,8) {TimezonePeriod.new(DateTime.new(1915,8,4,22,36,0),DateTime.new(1916,4,30,22,0,0),3600,0,:CET)}
|
220
|
-
|
221
|
-
assert_periods_equal([
|
222
|
-
TimezonePeriod.new(DateTime.new(1879,12,31,22,36,0),DateTime.new(1915,8,4,22,36,0),5040,0,:WMT),
|
223
|
-
TimezonePeriod.new(DateTime.new(1915,8,4,22,36,0),DateTime.new(1916,4,30,22,0,0),3600,0,:CET)],
|
224
|
-
list.periods_for_local(DateTime.new(1915,8,4,23,40,0)))
|
225
|
-
end
|
226
|
-
|
227
|
-
def test_period_for_local_unbounded
|
228
|
-
list = TimezonePeriodList.new
|
229
|
-
list.add_unbounded_start { TimezonePeriod.new(nil,DateTime.new(2000,10,2,1,0,0),-18000,3600,:'TESTD') }
|
230
|
-
list.add(2000, 10) { TimezonePeriod.new(DateTime.new(2000,10,2,1,0,0),DateTime.new(2001,3,2,1,0,0),-18000,0,:'TESTS') }
|
231
|
-
list.add(2001, 3) { TimezonePeriod.new(DateTime.new(2001,3,2,1,0,0),nil,-18000,3600,:'TESTD') }
|
232
|
-
|
233
|
-
assert_periods_equal([TimezonePeriod.new(nil,DateTime.new(2000,10,2,1,0,0),-18000,3600,:'TESTD')],
|
234
|
-
list.periods_for_local(DateTime.new(1999,12,1,1,0,0)))
|
235
|
-
assert_periods_equal([TimezonePeriod.new(nil,DateTime.new(2000,10,2,1,0,0),-18000,3600,:'TESTD')],
|
236
|
-
list.periods_for_local(DateTime.new(2000,10,1,20,59,59)))
|
237
|
-
assert_periods_equal([TimezonePeriod.new(nil,DateTime.new(2000,10,2,1,0,0),-18000,3600,:'TESTD')],
|
238
|
-
list.periods_for_local(DateTime.new(2000,10,1,19,59,59)))
|
239
|
-
assert_periods_equal([TimezonePeriod.new(nil,DateTime.new(2000,10,2,1,0,0),-18000,3600,:'TESTD'),
|
240
|
-
TimezonePeriod.new(DateTime.new(2000,10,2,1,0,0),DateTime.new(2001,3,2,1,0,0),-18000,0,:'TESTS')],
|
241
|
-
list.periods_for_local(DateTime.new(2000,10,1,20,0,0)))
|
242
|
-
assert_periods_equal([TimezonePeriod.new(nil,DateTime.new(2000,10,2,1,0,0),-18000,3600,:'TESTD'),
|
243
|
-
TimezonePeriod.new(DateTime.new(2000,10,2,1,0,0),DateTime.new(2001,3,2,1,0,0),-18000,0,:'TESTS')],
|
244
|
-
list.periods_for_local(DateTime.new(2000,10,1,20,59,59)))
|
245
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2000,10,2,1,0,0),DateTime.new(2001,3,2,1,0,0),-18000,0,:'TESTS')],
|
246
|
-
list.periods_for_local(DateTime.new(2000,10,1,21,0,0)))
|
247
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2000,10,2,1,0,0),DateTime.new(2001,3,2,1,0,0),-18000,0,:'TESTS')],
|
248
|
-
list.periods_for_local(DateTime.new(2001,3,1,19,59,59)))
|
249
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2000,10,2,1,0,0),DateTime.new(2001,3,2,1,0,0),-18000,0,:'TESTS')],
|
250
|
-
list.periods_for_local(DateTime.new(2001,3,1,19,59,59)))
|
251
|
-
|
252
|
-
assert_raise(PeriodNotFound) {
|
253
|
-
list.periods_for_local(DateTime.new(2001,3,1,20,0,0))
|
254
|
-
}
|
255
|
-
assert_raise(PeriodNotFound) {
|
256
|
-
list.periods_for_local(DateTime.new(2001,3,1,20,59,59))
|
257
|
-
}
|
258
|
-
|
259
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2001,3,2,1,0,0),nil,-18000,3600,:'TESTD')],
|
260
|
-
list.periods_for_local(DateTime.new(2001,3,1,21,0,0)))
|
261
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2001,3,2,1,0,0),nil,-18000,3600,:'TESTD')],
|
262
|
-
list.periods_for_local(DateTime.new(2002,1,1,21,0,0)))
|
263
|
-
end
|
264
|
-
|
265
|
-
def test_period_for_local_unbounded
|
266
|
-
list = TimezonePeriodList.new
|
267
|
-
list.add_unbounded_start { TimezonePeriod.new(nil,DateTime.new(2000,7,1,0,0,0),-3600,0,:'TESTD') }
|
268
|
-
list.add(2000, 7) { TimezonePeriod.new(DateTime.new(2000,7,1,0,0,0),nil,-3600,0,:'TESTS') }
|
269
|
-
|
270
|
-
# 2000-07-01 00:00:00 UTC is 2000-06-30 23:00:00 UTC-1
|
271
|
-
# hence to find periods for local times between 2000-06-30 23:00:00
|
272
|
-
# and 2000-07-01 00:00:00 a search has to be carried out in the next half
|
273
|
-
# year to the one containing the date we are looking for
|
274
|
-
|
275
|
-
assert_periods_equal([TimezonePeriod.new(nil,DateTime.new(2000,7,1,0,0,0),-3600,0,:'TESTD')],
|
276
|
-
list.periods_for_local(DateTime.new(2000,6,30,22,59,59)))
|
277
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2000,7,1,0,0,0),nil,-3600,0,:'TESTS')],
|
278
|
-
list.periods_for_local(DateTime.new(2000,6,30,23,0,0)))
|
279
|
-
assert_periods_equal([TimezonePeriod.new(DateTime.new(2000,7,1,0,0,0),nil,-3600,0,:'TESTS')],
|
280
|
-
list.periods_for_local(DateTime.new(2000,7,1,0,0,0)))
|
281
|
-
end
|
282
|
-
|
283
|
-
def test_unbounded_start_only
|
284
|
-
list = TimezonePeriodList.new
|
285
|
-
list.add_unbounded_start { TimezonePeriod.new(nil,nil,0,0,:'UTC') }
|
286
|
-
|
287
|
-
assert_period_equal(TimezonePeriod.new(nil,nil,0,0,:'UTC'),
|
288
|
-
list.period_for_utc(DateTime.new(2000,1,1,0,0,0)))
|
289
|
-
assert_periods_equal([TimezonePeriod.new(nil,nil,0,0,:'UTC')],
|
290
|
-
list.periods_for_local(DateTime.new(2000,1,1,0,0,0)))
|
291
|
-
end
|
292
|
-
|
293
|
-
private
|
294
|
-
def assert_period_equal(expected, actual)
|
295
|
-
assert_equal(expected.utc_start, actual.utc_start)
|
296
|
-
assert_equal(expected.utc_end, actual.utc_end)
|
297
|
-
assert_equal(expected.utc_offset, actual.utc_offset)
|
298
|
-
assert_equal(expected.std_offset, actual.std_offset)
|
299
|
-
assert_equal(expected.zone_identifier, actual.zone_identifier)
|
300
|
-
assert_equal(expected.local_start, actual.local_start)
|
301
|
-
assert_equal(expected.local_end, actual.local_end)
|
302
|
-
end
|
303
|
-
|
304
|
-
def assert_periods_equal(expected, actual)
|
305
|
-
assert_equal(expected.length, actual.length)
|
306
|
-
(0..expected.length - 1).each {|i|
|
307
|
-
assert_period_equal(expected[i], actual[i])
|
308
|
-
}
|
309
|
-
end
|
310
|
-
end
|