tzinfo 0.3.62 → 1.0.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.
- checksums.yaml +7 -0
- data/CHANGES +25 -158
- data/LICENSE +1 -1
- data/README +89 -55
- data/Rakefile +87 -282
- data/lib/tzinfo/country.rb +28 -34
- data/lib/tzinfo/country_index_definition.rb +2 -7
- data/lib/tzinfo/country_info.rb +20 -44
- data/lib/tzinfo/country_timezone.rb +1 -1
- data/lib/tzinfo/data_source.rb +182 -0
- data/lib/tzinfo/data_timezone.rb +1 -3
- data/lib/tzinfo/data_timezone_info.rb +11 -190
- data/lib/tzinfo/info_timezone.rb +1 -3
- data/lib/tzinfo/linked_timezone.rb +1 -4
- data/lib/tzinfo/linked_timezone_info.rb +9 -5
- data/lib/tzinfo/offset_rationals.rb +2 -4
- data/lib/tzinfo/ruby_core_support.rb +152 -82
- data/lib/tzinfo/ruby_country_info.rb +78 -0
- data/lib/tzinfo/ruby_data_source.rb +153 -0
- data/lib/tzinfo/time_or_datetime.rb +83 -52
- data/lib/tzinfo/timezone.rb +27 -69
- data/lib/tzinfo/timezone_definition.rb +4 -7
- data/lib/tzinfo/timezone_index_definition.rb +1 -6
- data/lib/tzinfo/timezone_info.rb +8 -4
- data/lib/tzinfo/timezone_offset_info.rb +1 -3
- data/lib/tzinfo/timezone_period.rb +31 -6
- data/lib/tzinfo/timezone_transition_info.rb +42 -12
- data/lib/tzinfo/transition_data_timezone_info.rb +223 -0
- data/lib/tzinfo/zoneinfo_country_info.rb +50 -0
- data/lib/tzinfo/zoneinfo_data_source.rb +297 -0
- data/lib/tzinfo/zoneinfo_timezone_info.rb +226 -0
- data/lib/tzinfo.rb +9 -7
- data/test/tc_country.rb +65 -9
- data/test/tc_country_index_definition.rb +27 -6
- data/test/tc_country_info.rb +23 -57
- data/test/tc_country_timezone.rb +23 -3
- data/test/tc_data_source.rb +194 -0
- data/test/tc_data_timezone.rb +23 -3
- data/test/tc_data_timezone_info.rb +30 -272
- data/test/tc_info_timezone.rb +23 -3
- data/test/tc_linked_timezone.rb +23 -4
- data/test/tc_linked_timezone_info.rb +30 -3
- data/test/tc_offset_rationals.rb +23 -3
- data/test/tc_ruby_core_support.rb +117 -31
- data/test/tc_ruby_country_info.rb +102 -0
- data/test/tc_ruby_data_source.rb +145 -0
- data/test/tc_time_or_datetime.rb +222 -19
- data/test/tc_timezone.rb +187 -57
- data/test/tc_timezone_definition.rb +26 -6
- data/test/tc_timezone_index_definition.rb +23 -3
- data/test/tc_timezone_info.rb +23 -3
- data/test/tc_timezone_london.rb +89 -56
- data/test/tc_timezone_melbourne.rb +88 -62
- data/test/tc_timezone_new_york.rb +73 -47
- data/test/tc_timezone_offset_info.rb +36 -4
- data/test/tc_timezone_period.rb +60 -22
- data/test/tc_timezone_proxy.rb +24 -4
- data/test/tc_timezone_transition_info.rb +305 -28
- data/test/tc_timezone_utc.rb +24 -4
- data/test/tc_transition_data_timezone_info.rb +345 -0
- data/test/tc_zoneinfo_country_info.rb +86 -0
- data/test/tc_zoneinfo_data_source.rb +601 -0
- data/test/tc_zoneinfo_timezone_info.rb +663 -0
- data/test/test_utils.rb +116 -21
- data/test/ts_all.rb +24 -4
- data/test/ts_all_ruby.rb +27 -0
- data/test/ts_all_zoneinfo.rb +29 -0
- data/test/tzinfo-data/tzinfo/data/definitions/America/Argentina/Buenos_Aires.rb +89 -0
- data/test/tzinfo-data/tzinfo/data/definitions/America/New_York.rb +313 -0
- data/test/tzinfo-data/tzinfo/data/definitions/Australia/Melbourne.rb +216 -0
- data/test/tzinfo-data/tzinfo/data/definitions/EST.rb +19 -0
- data/test/tzinfo-data/tzinfo/data/definitions/Etc/GMT__m__1.rb +21 -0
- data/test/tzinfo-data/tzinfo/data/definitions/Etc/GMT__p__1.rb +21 -0
- data/test/tzinfo-data/tzinfo/data/definitions/Etc/UTC.rb +21 -0
- data/test/tzinfo-data/tzinfo/data/definitions/Europe/Amsterdam.rb +259 -0
- data/test/tzinfo-data/tzinfo/data/definitions/Europe/Andorra.rb +184 -0
- data/test/tzinfo-data/tzinfo/data/definitions/Europe/London.rb +319 -0
- data/test/tzinfo-data/tzinfo/data/definitions/Europe/Paris.rb +263 -0
- data/test/tzinfo-data/tzinfo/data/definitions/Europe/Prague.rb +218 -0
- data/test/tzinfo-data/tzinfo/data/definitions/UTC.rb +16 -0
- data/test/tzinfo-data/tzinfo/data/indexes/countries.rb +929 -0
- data/test/tzinfo-data/tzinfo/data/indexes/timezones.rb +599 -0
- data/test/tzinfo-data/tzinfo/data/version.rb +36 -0
- data/test/tzinfo-data/tzinfo/data.rb +23 -0
- data/test/zoneinfo/America/Argentina/Buenos_Aires +0 -0
- data/test/zoneinfo/America/New_York +0 -0
- data/test/zoneinfo/Australia/Melbourne +0 -0
- data/test/zoneinfo/EST +0 -0
- data/test/zoneinfo/Etc/UTC +0 -0
- data/test/zoneinfo/Europe/Amsterdam +0 -0
- data/test/zoneinfo/Europe/Andorra +0 -0
- data/test/zoneinfo/Europe/London +0 -0
- data/test/zoneinfo/Europe/Paris +0 -0
- data/test/zoneinfo/Europe/Prague +0 -0
- data/test/zoneinfo/Factory +0 -0
- data/test/zoneinfo/UTC +0 -0
- data/test/zoneinfo/iso3166.tab +276 -0
- data/test/zoneinfo/localtime +0 -0
- data/test/zoneinfo/posix/Europe/London +0 -0
- data/test/zoneinfo/posixrules +0 -0
- data/test/zoneinfo/right/Europe/London +0 -0
- data/test/zoneinfo/zone.tab +444 -0
- metadata +134 -716
- data/.yardopts +0 -8
- data/lib/tzinfo/definitions/Africa/Abidjan.rb +0 -18
- data/lib/tzinfo/definitions/Africa/Accra.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Addis_Ababa.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Algiers.rb +0 -55
- data/lib/tzinfo/definitions/Africa/Asmara.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Asmera.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Bamako.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Bangui.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Banjul.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Bissau.rb +0 -20
- data/lib/tzinfo/definitions/Africa/Blantyre.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Brazzaville.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Bujumbura.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Cairo.rb +0 -247
- data/lib/tzinfo/definitions/Africa/Casablanca.rb +0 -189
- data/lib/tzinfo/definitions/Africa/Ceuta.rb +0 -218
- data/lib/tzinfo/definitions/Africa/Conakry.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Dakar.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Dar_es_Salaam.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Djibouti.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Douala.rb +0 -13
- data/lib/tzinfo/definitions/Africa/El_Aaiun.rb +0 -179
- data/lib/tzinfo/definitions/Africa/Freetown.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Gaborone.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Harare.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Johannesburg.rb +0 -25
- data/lib/tzinfo/definitions/Africa/Juba.rb +0 -54
- data/lib/tzinfo/definitions/Africa/Kampala.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Khartoum.rb +0 -54
- data/lib/tzinfo/definitions/Africa/Kigali.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Kinshasa.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Lagos.rb +0 -23
- data/lib/tzinfo/definitions/Africa/Libreville.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Lome.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Luanda.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Lubumbashi.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Lusaka.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Malabo.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Maputo.rb +0 -18
- data/lib/tzinfo/definitions/Africa/Maseru.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Mbabane.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Mogadishu.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Monrovia.rb +0 -22
- data/lib/tzinfo/definitions/Africa/Nairobi.rb +0 -24
- data/lib/tzinfo/definitions/Africa/Ndjamena.rb +0 -21
- data/lib/tzinfo/definitions/Africa/Niamey.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Nouakchott.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Ouagadougou.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Porto__m__Novo.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Sao_Tome.rb +0 -23
- data/lib/tzinfo/definitions/Africa/Timbuktu.rb +0 -13
- data/lib/tzinfo/definitions/Africa/Tripoli.rb +0 -51
- data/lib/tzinfo/definitions/Africa/Tunis.rb +0 -53
- data/lib/tzinfo/definitions/Africa/Windhoek.rb +0 -74
- data/lib/tzinfo/definitions/America/Adak.rb +0 -242
- data/lib/tzinfo/definitions/America/Anchorage.rb +0 -242
- data/lib/tzinfo/definitions/America/Anguilla.rb +0 -13
- data/lib/tzinfo/definitions/America/Antigua.rb +0 -13
- data/lib/tzinfo/definitions/America/Araguaina.rb +0 -69
- data/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb +0 -84
- data/lib/tzinfo/definitions/America/Argentina/Catamarca.rb +0 -84
- data/lib/tzinfo/definitions/America/Argentina/ComodRivadavia.rb +0 -15
- data/lib/tzinfo/definitions/America/Argentina/Cordoba.rb +0 -84
- data/lib/tzinfo/definitions/America/Argentina/Jujuy.rb +0 -82
- data/lib/tzinfo/definitions/America/Argentina/La_Rioja.rb +0 -85
- data/lib/tzinfo/definitions/America/Argentina/Mendoza.rb +0 -84
- data/lib/tzinfo/definitions/America/Argentina/Rio_Gallegos.rb +0 -84
- data/lib/tzinfo/definitions/America/Argentina/Salta.rb +0 -82
- data/lib/tzinfo/definitions/America/Argentina/San_Juan.rb +0 -85
- data/lib/tzinfo/definitions/America/Argentina/San_Luis.rb +0 -85
- data/lib/tzinfo/definitions/America/Argentina/Tucuman.rb +0 -86
- data/lib/tzinfo/definitions/America/Argentina/Ushuaia.rb +0 -84
- data/lib/tzinfo/definitions/America/Aruba.rb +0 -13
- data/lib/tzinfo/definitions/America/Asuncion.rb +0 -220
- data/lib/tzinfo/definitions/America/Atikokan.rb +0 -13
- data/lib/tzinfo/definitions/America/Atka.rb +0 -13
- data/lib/tzinfo/definitions/America/Bahia.rb +0 -79
- data/lib/tzinfo/definitions/America/Bahia_Banderas.rb +0 -84
- data/lib/tzinfo/definitions/America/Barbados.rb +0 -34
- data/lib/tzinfo/definitions/America/Belem.rb +0 -47
- data/lib/tzinfo/definitions/America/Belize.rb +0 -119
- data/lib/tzinfo/definitions/America/Blanc__m__Sablon.rb +0 -13
- data/lib/tzinfo/definitions/America/Boa_Vista.rb +0 -51
- data/lib/tzinfo/definitions/America/Bogota.rb +0 -23
- data/lib/tzinfo/definitions/America/Boise.rb +0 -245
- data/lib/tzinfo/definitions/America/Buenos_Aires.rb +0 -13
- data/lib/tzinfo/definitions/America/Cambridge_Bay.rb +0 -232
- data/lib/tzinfo/definitions/America/Campo_Grande.rb +0 -109
- data/lib/tzinfo/definitions/America/Cancun.rb +0 -62
- data/lib/tzinfo/definitions/America/Caracas.rb +0 -24
- data/lib/tzinfo/definitions/America/Catamarca.rb +0 -13
- data/lib/tzinfo/definitions/America/Cayenne.rb +0 -20
- data/lib/tzinfo/definitions/America/Cayman.rb +0 -13
- data/lib/tzinfo/definitions/America/Chicago.rb +0 -329
- data/lib/tzinfo/definitions/America/Chihuahua.rb +0 -80
- data/lib/tzinfo/definitions/America/Ciudad_Juarez.rb +0 -183
- data/lib/tzinfo/definitions/America/Coral_Harbour.rb +0 -13
- data/lib/tzinfo/definitions/America/Cordoba.rb +0 -13
- data/lib/tzinfo/definitions/America/Costa_Rica.rb +0 -29
- data/lib/tzinfo/definitions/America/Creston.rb +0 -13
- data/lib/tzinfo/definitions/America/Cuiaba.rb +0 -107
- data/lib/tzinfo/definitions/America/Curacao.rb +0 -13
- data/lib/tzinfo/definitions/America/Danmarkshavn.rb +0 -53
- data/lib/tzinfo/definitions/America/Dawson.rb +0 -117
- data/lib/tzinfo/definitions/America/Dawson_Creek.rb +0 -79
- data/lib/tzinfo/definitions/America/Denver.rb +0 -250
- data/lib/tzinfo/definitions/America/Detroit.rb +0 -234
- data/lib/tzinfo/definitions/America/Dominica.rb +0 -13
- data/lib/tzinfo/definitions/America/Edmonton.rb +0 -242
- data/lib/tzinfo/definitions/America/Eirunepe.rb +0 -52
- data/lib/tzinfo/definitions/America/El_Salvador.rb +0 -23
- data/lib/tzinfo/definitions/America/Ensenada.rb +0 -13
- data/lib/tzinfo/definitions/America/Fort_Nelson.rb +0 -164
- data/lib/tzinfo/definitions/America/Fort_Wayne.rb +0 -13
- data/lib/tzinfo/definitions/America/Fortaleza.rb +0 -57
- data/lib/tzinfo/definitions/America/Glace_Bay.rb +0 -232
- data/lib/tzinfo/definitions/America/Godthab.rb +0 -13
- data/lib/tzinfo/definitions/America/Goose_Bay.rb +0 -301
- data/lib/tzinfo/definitions/America/Grand_Turk.rb +0 -207
- data/lib/tzinfo/definitions/America/Grenada.rb +0 -13
- data/lib/tzinfo/definitions/America/Guadeloupe.rb +0 -13
- data/lib/tzinfo/definitions/America/Guatemala.rb +0 -27
- data/lib/tzinfo/definitions/America/Guayaquil.rb +0 -23
- data/lib/tzinfo/definitions/America/Guyana.rb +0 -23
- data/lib/tzinfo/definitions/America/Halifax.rb +0 -320
- data/lib/tzinfo/definitions/America/Havana.rb +0 -247
- data/lib/tzinfo/definitions/America/Hermosillo.rb +0 -35
- data/lib/tzinfo/definitions/America/Indiana/Indianapolis.rb +0 -195
- data/lib/tzinfo/definitions/America/Indiana/Knox.rb +0 -249
- data/lib/tzinfo/definitions/America/Indiana/Marengo.rb +0 -199
- data/lib/tzinfo/definitions/America/Indiana/Petersburg.rb +0 -212
- data/lib/tzinfo/definitions/America/Indiana/Tell_City.rb +0 -194
- data/lib/tzinfo/definitions/America/Indiana/Vevay.rb +0 -177
- data/lib/tzinfo/definitions/America/Indiana/Vincennes.rb +0 -197
- data/lib/tzinfo/definitions/America/Indiana/Winamac.rb +0 -203
- data/lib/tzinfo/definitions/America/Indianapolis.rb +0 -13
- data/lib/tzinfo/definitions/America/Inuvik.rb +0 -225
- data/lib/tzinfo/definitions/America/Iqaluit.rb +0 -229
- data/lib/tzinfo/definitions/America/Jamaica.rb +0 -41
- data/lib/tzinfo/definitions/America/Jujuy.rb +0 -13
- data/lib/tzinfo/definitions/America/Juneau.rb +0 -241
- data/lib/tzinfo/definitions/America/Kentucky/Louisville.rb +0 -274
- data/lib/tzinfo/definitions/America/Kentucky/Monticello.rb +0 -244
- data/lib/tzinfo/definitions/America/Knox_IN.rb +0 -13
- data/lib/tzinfo/definitions/America/Kralendijk.rb +0 -13
- data/lib/tzinfo/definitions/America/La_Paz.rb +0 -22
- data/lib/tzinfo/definitions/America/Lima.rb +0 -35
- data/lib/tzinfo/definitions/America/Los_Angeles.rb +0 -278
- data/lib/tzinfo/definitions/America/Louisville.rb +0 -13
- data/lib/tzinfo/definitions/America/Lower_Princes.rb +0 -13
- data/lib/tzinfo/definitions/America/Maceio.rb +0 -59
- data/lib/tzinfo/definitions/America/Managua.rb +0 -36
- data/lib/tzinfo/definitions/America/Manaus.rb +0 -49
- data/lib/tzinfo/definitions/America/Marigot.rb +0 -13
- data/lib/tzinfo/definitions/America/Martinique.rb +0 -23
- data/lib/tzinfo/definitions/America/Matamoros.rb +0 -177
- data/lib/tzinfo/definitions/America/Mazatlan.rb +0 -83
- data/lib/tzinfo/definitions/America/Mendoza.rb +0 -13
- data/lib/tzinfo/definitions/America/Menominee.rb +0 -236
- data/lib/tzinfo/definitions/America/Merida.rb +0 -76
- data/lib/tzinfo/definitions/America/Metlakatla.rb +0 -176
- data/lib/tzinfo/definitions/America/Mexico_City.rb +0 -89
- data/lib/tzinfo/definitions/America/Miquelon.rb +0 -195
- data/lib/tzinfo/definitions/America/Moncton.rb +0 -300
- data/lib/tzinfo/definitions/America/Monterrey.rb +0 -75
- data/lib/tzinfo/definitions/America/Montevideo.rb +0 -110
- data/lib/tzinfo/definitions/America/Montreal.rb +0 -13
- data/lib/tzinfo/definitions/America/Montserrat.rb +0 -13
- data/lib/tzinfo/definitions/America/Nassau.rb +0 -13
- data/lib/tzinfo/definitions/America/New_York.rb +0 -328
- data/lib/tzinfo/definitions/America/Nipigon.rb +0 -13
- data/lib/tzinfo/definitions/America/Nome.rb +0 -242
- data/lib/tzinfo/definitions/America/Noronha.rb +0 -57
- data/lib/tzinfo/definitions/America/North_Dakota/Beulah.rb +0 -246
- data/lib/tzinfo/definitions/America/North_Dakota/Center.rb +0 -246
- data/lib/tzinfo/definitions/America/North_Dakota/New_Salem.rb +0 -246
- data/lib/tzinfo/definitions/America/Nuuk.rb +0 -209
- data/lib/tzinfo/definitions/America/Ojinaga.rb +0 -182
- data/lib/tzinfo/definitions/America/Panama.rb +0 -20
- data/lib/tzinfo/definitions/America/Pangnirtung.rb +0 -13
- data/lib/tzinfo/definitions/America/Paramaribo.rb +0 -24
- data/lib/tzinfo/definitions/America/Phoenix.rb +0 -30
- data/lib/tzinfo/definitions/America/Port__m__au__m__Prince.rb +0 -177
- data/lib/tzinfo/definitions/America/Port_of_Spain.rb +0 -13
- data/lib/tzinfo/definitions/America/Porto_Acre.rb +0 -13
- data/lib/tzinfo/definitions/America/Porto_Velho.rb +0 -47
- data/lib/tzinfo/definitions/America/Puerto_Rico.rb +0 -23
- data/lib/tzinfo/definitions/America/Punta_Arenas.rb +0 -139
- data/lib/tzinfo/definitions/America/Rainy_River.rb +0 -13
- data/lib/tzinfo/definitions/America/Rankin_Inlet.rb +0 -224
- data/lib/tzinfo/definitions/America/Recife.rb +0 -57
- data/lib/tzinfo/definitions/America/Regina.rb +0 -74
- data/lib/tzinfo/definitions/America/Resolute.rb +0 -224
- data/lib/tzinfo/definitions/America/Rio_Branco.rb +0 -50
- data/lib/tzinfo/definitions/America/Rosario.rb +0 -13
- data/lib/tzinfo/definitions/America/Santa_Isabel.rb +0 -13
- data/lib/tzinfo/definitions/America/Santarem.rb +0 -49
- data/lib/tzinfo/definitions/America/Santiago.rb +0 -251
- data/lib/tzinfo/definitions/America/Santo_Domingo.rb +0 -38
- data/lib/tzinfo/definitions/America/Sao_Paulo.rb +0 -109
- data/lib/tzinfo/definitions/America/Scoresbysund.rb +0 -209
- data/lib/tzinfo/definitions/America/Shiprock.rb +0 -13
- data/lib/tzinfo/definitions/America/Sitka.rb +0 -240
- data/lib/tzinfo/definitions/America/St_Barthelemy.rb +0 -13
- data/lib/tzinfo/definitions/America/St_Johns.rb +0 -334
- data/lib/tzinfo/definitions/America/St_Kitts.rb +0 -13
- data/lib/tzinfo/definitions/America/St_Lucia.rb +0 -13
- data/lib/tzinfo/definitions/America/St_Thomas.rb +0 -13
- data/lib/tzinfo/definitions/America/St_Vincent.rb +0 -13
- data/lib/tzinfo/definitions/America/Swift_Current.rb +0 -44
- data/lib/tzinfo/definitions/America/Tegucigalpa.rb +0 -25
- data/lib/tzinfo/definitions/America/Thule.rb +0 -185
- data/lib/tzinfo/definitions/America/Thunder_Bay.rb +0 -13
- data/lib/tzinfo/definitions/America/Tijuana.rb +0 -242
- data/lib/tzinfo/definitions/America/Toronto.rb +0 -325
- data/lib/tzinfo/definitions/America/Tortola.rb +0 -13
- data/lib/tzinfo/definitions/America/Vancouver.rb +0 -282
- data/lib/tzinfo/definitions/America/Virgin.rb +0 -13
- data/lib/tzinfo/definitions/America/Whitehorse.rb +0 -117
- data/lib/tzinfo/definitions/America/Winnipeg.rb +0 -278
- data/lib/tzinfo/definitions/America/Yakutat.rb +0 -239
- data/lib/tzinfo/definitions/America/Yellowknife.rb +0 -13
- data/lib/tzinfo/definitions/Antarctica/Casey.rb +0 -30
- data/lib/tzinfo/definitions/Antarctica/Davis.rb +0 -25
- data/lib/tzinfo/definitions/Antarctica/DumontDUrville.rb +0 -13
- data/lib/tzinfo/definitions/Antarctica/Macquarie.rb +0 -233
- data/lib/tzinfo/definitions/Antarctica/Mawson.rb +0 -20
- data/lib/tzinfo/definitions/Antarctica/McMurdo.rb +0 -13
- data/lib/tzinfo/definitions/Antarctica/Palmer.rb +0 -102
- data/lib/tzinfo/definitions/Antarctica/Rothera.rb +0 -18
- data/lib/tzinfo/definitions/Antarctica/South_Pole.rb +0 -13
- data/lib/tzinfo/definitions/Antarctica/Syowa.rb +0 -13
- data/lib/tzinfo/definitions/Antarctica/Troll.rb +0 -157
- data/lib/tzinfo/definitions/Antarctica/Vostok.rb +0 -13
- data/lib/tzinfo/definitions/Arctic/Longyearbyen.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Aden.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Almaty.rb +0 -71
- data/lib/tzinfo/definitions/Asia/Amman.rb +0 -106
- data/lib/tzinfo/definitions/Asia/Anadyr.rb +0 -86
- data/lib/tzinfo/definitions/Asia/Aqtau.rb +0 -71
- data/lib/tzinfo/definitions/Asia/Aqtobe.rb +0 -72
- data/lib/tzinfo/definitions/Asia/Ashgabat.rb +0 -45
- data/lib/tzinfo/definitions/Asia/Ashkhabad.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Atyrau.rb +0 -72
- data/lib/tzinfo/definitions/Asia/Baghdad.rb +0 -73
- data/lib/tzinfo/definitions/Asia/Bahrain.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Baku.rb +0 -86
- data/lib/tzinfo/definitions/Asia/Bangkok.rb +0 -20
- data/lib/tzinfo/definitions/Asia/Barnaul.rb +0 -87
- data/lib/tzinfo/definitions/Asia/Beirut.rb +0 -231
- data/lib/tzinfo/definitions/Asia/Bishkek.rb +0 -72
- data/lib/tzinfo/definitions/Asia/Brunei.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Calcutta.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Chita.rb +0 -87
- data/lib/tzinfo/definitions/Asia/Choibalsan.rb +0 -72
- data/lib/tzinfo/definitions/Asia/Chongqing.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Chungking.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Colombo.rb +0 -30
- data/lib/tzinfo/definitions/Asia/Dacca.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Damascus.rb +0 -140
- data/lib/tzinfo/definitions/Asia/Dhaka.rb +0 -28
- data/lib/tzinfo/definitions/Asia/Dili.rb +0 -22
- data/lib/tzinfo/definitions/Asia/Dubai.rb +0 -18
- data/lib/tzinfo/definitions/Asia/Dushanbe.rb +0 -44
- data/lib/tzinfo/definitions/Asia/Famagusta.rb +0 -217
- data/lib/tzinfo/definitions/Asia/Gaza.rb +0 -274
- data/lib/tzinfo/definitions/Asia/Harbin.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Hebron.rb +0 -276
- data/lib/tzinfo/definitions/Asia/Ho_Chi_Minh.rb +0 -29
- data/lib/tzinfo/definitions/Asia/Hong_Kong.rb +0 -89
- data/lib/tzinfo/definitions/Asia/Hovd.rb +0 -69
- data/lib/tzinfo/definitions/Asia/Irkutsk.rb +0 -88
- data/lib/tzinfo/definitions/Asia/Istanbul.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Jakarta.rb +0 -30
- data/lib/tzinfo/definitions/Asia/Jayapura.rb +0 -22
- data/lib/tzinfo/definitions/Asia/Jerusalem.rb +0 -241
- data/lib/tzinfo/definitions/Asia/Kabul.rb +0 -20
- data/lib/tzinfo/definitions/Asia/Kamchatka.rb +0 -84
- data/lib/tzinfo/definitions/Asia/Karachi.rb +0 -32
- data/lib/tzinfo/definitions/Asia/Kashgar.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Kathmandu.rb +0 -20
- data/lib/tzinfo/definitions/Asia/Katmandu.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Khandyga.rb +0 -90
- data/lib/tzinfo/definitions/Asia/Kolkata.rb +0 -27
- data/lib/tzinfo/definitions/Asia/Krasnoyarsk.rb +0 -86
- data/lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Kuching.rb +0 -38
- data/lib/tzinfo/definitions/Asia/Kuwait.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Macao.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Macau.rb +0 -91
- data/lib/tzinfo/definitions/Asia/Magadan.rb +0 -87
- data/lib/tzinfo/definitions/Asia/Makassar.rb +0 -24
- data/lib/tzinfo/definitions/Asia/Manila.rb +0 -30
- data/lib/tzinfo/definitions/Asia/Muscat.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Nicosia.rb +0 -217
- data/lib/tzinfo/definitions/Asia/Novokuznetsk.rb +0 -84
- data/lib/tzinfo/definitions/Asia/Novosibirsk.rb +0 -87
- data/lib/tzinfo/definitions/Asia/Omsk.rb +0 -86
- data/lib/tzinfo/definitions/Asia/Oral.rb +0 -73
- data/lib/tzinfo/definitions/Asia/Phnom_Penh.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Pontianak.rb +0 -30
- data/lib/tzinfo/definitions/Asia/Pyongyang.rb +0 -24
- data/lib/tzinfo/definitions/Asia/Qatar.rb +0 -20
- data/lib/tzinfo/definitions/Asia/Qostanay.rb +0 -72
- data/lib/tzinfo/definitions/Asia/Qyzylorda.rb +0 -73
- data/lib/tzinfo/definitions/Asia/Rangoon.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Riyadh.rb +0 -18
- data/lib/tzinfo/definitions/Asia/Saigon.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Sakhalin.rb +0 -87
- data/lib/tzinfo/definitions/Asia/Samarkand.rb +0 -44
- data/lib/tzinfo/definitions/Asia/Seoul.rb +0 -50
- data/lib/tzinfo/definitions/Asia/Shanghai.rb +0 -47
- data/lib/tzinfo/definitions/Asia/Singapore.rb +0 -31
- data/lib/tzinfo/definitions/Asia/Srednekolymsk.rb +0 -86
- data/lib/tzinfo/definitions/Asia/Taipei.rb +0 -60
- data/lib/tzinfo/definitions/Asia/Tashkent.rb +0 -44
- data/lib/tzinfo/definitions/Asia/Tbilisi.rb +0 -73
- data/lib/tzinfo/definitions/Asia/Tehran.rb +0 -92
- data/lib/tzinfo/definitions/Asia/Tel_Aviv.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Thimbu.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Thimphu.rb +0 -20
- data/lib/tzinfo/definitions/Asia/Tokyo.rb +0 -27
- data/lib/tzinfo/definitions/Asia/Tomsk.rb +0 -87
- data/lib/tzinfo/definitions/Asia/Ujung_Pandang.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Ulaanbaatar.rb +0 -69
- data/lib/tzinfo/definitions/Asia/Ulan_Bator.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Urumqi.rb +0 -18
- data/lib/tzinfo/definitions/Asia/Ust__m__Nera.rb +0 -89
- data/lib/tzinfo/definitions/Asia/Vientiane.rb +0 -13
- data/lib/tzinfo/definitions/Asia/Vladivostok.rb +0 -86
- data/lib/tzinfo/definitions/Asia/Yakutsk.rb +0 -86
- data/lib/tzinfo/definitions/Asia/Yangon.rb +0 -23
- data/lib/tzinfo/definitions/Asia/Yekaterinburg.rb +0 -88
- data/lib/tzinfo/definitions/Asia/Yerevan.rb +0 -82
- data/lib/tzinfo/definitions/Atlantic/Azores.rb +0 -318
- data/lib/tzinfo/definitions/Atlantic/Bermuda.rb +0 -248
- data/lib/tzinfo/definitions/Atlantic/Canary.rb +0 -209
- data/lib/tzinfo/definitions/Atlantic/Cape_Verde.rb +0 -23
- data/lib/tzinfo/definitions/Atlantic/Faeroe.rb +0 -13
- data/lib/tzinfo/definitions/Atlantic/Faroe.rb +0 -205
- data/lib/tzinfo/definitions/Atlantic/Jan_Mayen.rb +0 -13
- data/lib/tzinfo/definitions/Atlantic/Madeira.rb +0 -317
- data/lib/tzinfo/definitions/Atlantic/Reykjavik.rb +0 -13
- data/lib/tzinfo/definitions/Atlantic/South_Georgia.rb +0 -18
- data/lib/tzinfo/definitions/Atlantic/St_Helena.rb +0 -13
- data/lib/tzinfo/definitions/Atlantic/Stanley.rb +0 -91
- data/lib/tzinfo/definitions/Australia/ACT.rb +0 -13
- data/lib/tzinfo/definitions/Australia/Adelaide.rb +0 -233
- data/lib/tzinfo/definitions/Australia/Brisbane.rb +0 -35
- data/lib/tzinfo/definitions/Australia/Broken_Hill.rb +0 -235
- data/lib/tzinfo/definitions/Australia/Canberra.rb +0 -13
- data/lib/tzinfo/definitions/Australia/Currie.rb +0 -13
- data/lib/tzinfo/definitions/Australia/Darwin.rb +0 -29
- data/lib/tzinfo/definitions/Australia/Eucla.rb +0 -37
- data/lib/tzinfo/definitions/Australia/Hobart.rb +0 -243
- data/lib/tzinfo/definitions/Australia/LHI.rb +0 -13
- data/lib/tzinfo/definitions/Australia/Lindeman.rb +0 -39
- data/lib/tzinfo/definitions/Australia/Lord_Howe.rb +0 -206
- data/lib/tzinfo/definitions/Australia/Melbourne.rb +0 -231
- data/lib/tzinfo/definitions/Australia/NSW.rb +0 -13
- data/lib/tzinfo/definitions/Australia/North.rb +0 -13
- data/lib/tzinfo/definitions/Australia/Perth.rb +0 -37
- data/lib/tzinfo/definitions/Australia/Queensland.rb +0 -13
- data/lib/tzinfo/definitions/Australia/South.rb +0 -13
- data/lib/tzinfo/definitions/Australia/Sydney.rb +0 -231
- data/lib/tzinfo/definitions/Australia/Tasmania.rb +0 -13
- data/lib/tzinfo/definitions/Australia/Victoria.rb +0 -13
- data/lib/tzinfo/definitions/Australia/West.rb +0 -13
- data/lib/tzinfo/definitions/Australia/Yancowinna.rb +0 -13
- data/lib/tzinfo/definitions/Brazil/Acre.rb +0 -13
- data/lib/tzinfo/definitions/Brazil/DeNoronha.rb +0 -13
- data/lib/tzinfo/definitions/Brazil/East.rb +0 -13
- data/lib/tzinfo/definitions/Brazil/West.rb +0 -13
- data/lib/tzinfo/definitions/CET.rb +0 -223
- data/lib/tzinfo/definitions/CST6CDT.rb +0 -238
- data/lib/tzinfo/definitions/Canada/Atlantic.rb +0 -13
- data/lib/tzinfo/definitions/Canada/Central.rb +0 -13
- data/lib/tzinfo/definitions/Canada/Eastern.rb +0 -13
- data/lib/tzinfo/definitions/Canada/Mountain.rb +0 -13
- data/lib/tzinfo/definitions/Canada/Newfoundland.rb +0 -13
- data/lib/tzinfo/definitions/Canada/Pacific.rb +0 -13
- data/lib/tzinfo/definitions/Canada/Saskatchewan.rb +0 -13
- data/lib/tzinfo/definitions/Canada/Yukon.rb +0 -13
- data/lib/tzinfo/definitions/Chile/Continental.rb +0 -13
- data/lib/tzinfo/definitions/Chile/EasterIsland.rb +0 -13
- data/lib/tzinfo/definitions/Cuba.rb +0 -11
- data/lib/tzinfo/definitions/EET.rb +0 -209
- data/lib/tzinfo/definitions/EST.rb +0 -14
- data/lib/tzinfo/definitions/EST5EDT.rb +0 -238
- data/lib/tzinfo/definitions/Egypt.rb +0 -11
- data/lib/tzinfo/definitions/Eire.rb +0 -11
- data/lib/tzinfo/definitions/Etc/GMT.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT0.rb +0 -13
- data/lib/tzinfo/definitions/Etc/GMT__m__0.rb +0 -13
- data/lib/tzinfo/definitions/Etc/GMT__m__1.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__m__10.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__m__11.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__m__12.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__m__13.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__m__14.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__m__2.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__m__3.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__m__4.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__m__5.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__m__6.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__m__7.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__m__8.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__m__9.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__p__0.rb +0 -13
- data/lib/tzinfo/definitions/Etc/GMT__p__1.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__p__10.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__p__11.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__p__12.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__p__2.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__p__3.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__p__4.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__p__5.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__p__6.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__p__7.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__p__8.rb +0 -16
- data/lib/tzinfo/definitions/Etc/GMT__p__9.rb +0 -16
- data/lib/tzinfo/definitions/Etc/Greenwich.rb +0 -13
- data/lib/tzinfo/definitions/Etc/UCT.rb +0 -13
- data/lib/tzinfo/definitions/Etc/UTC.rb +0 -16
- data/lib/tzinfo/definitions/Etc/Universal.rb +0 -13
- data/lib/tzinfo/definitions/Etc/Zulu.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Amsterdam.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Andorra.rb +0 -199
- data/lib/tzinfo/definitions/Europe/Astrakhan.rb +0 -84
- data/lib/tzinfo/definitions/Europe/Athens.rb +0 -231
- data/lib/tzinfo/definitions/Europe/Belfast.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Belgrade.rb +0 -209
- data/lib/tzinfo/definitions/Europe/Berlin.rb +0 -234
- data/lib/tzinfo/definitions/Europe/Bratislava.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Brussels.rb +0 -278
- data/lib/tzinfo/definitions/Europe/Bucharest.rb +0 -227
- data/lib/tzinfo/definitions/Europe/Budapest.rb +0 -241
- data/lib/tzinfo/definitions/Europe/Busingen.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Chisinau.rb +0 -237
- data/lib/tzinfo/definitions/Europe/Copenhagen.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Dublin.rb +0 -322
- data/lib/tzinfo/definitions/Europe/Gibraltar.rb +0 -291
- data/lib/tzinfo/definitions/Europe/Guernsey.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Helsinki.rb +0 -209
- data/lib/tzinfo/definitions/Europe/Isle_of_Man.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Istanbul.rb +0 -136
- data/lib/tzinfo/definitions/Europe/Jersey.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Kaliningrad.rb +0 -103
- data/lib/tzinfo/definitions/Europe/Kiev.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Kirov.rb +0 -85
- data/lib/tzinfo/definitions/Europe/Kyiv.rb +0 -216
- data/lib/tzinfo/definitions/Europe/Lisbon.rb +0 -316
- data/lib/tzinfo/definitions/Europe/Ljubljana.rb +0 -13
- data/lib/tzinfo/definitions/Europe/London.rb +0 -334
- data/lib/tzinfo/definitions/Europe/Luxembourg.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Madrid.rb +0 -255
- data/lib/tzinfo/definitions/Europe/Malta.rb +0 -259
- data/lib/tzinfo/definitions/Europe/Mariehamn.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Minsk.rb +0 -92
- data/lib/tzinfo/definitions/Europe/Monaco.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Moscow.rb +0 -104
- data/lib/tzinfo/definitions/Europe/Nicosia.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Oslo.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Paris.rb +0 -278
- data/lib/tzinfo/definitions/Europe/Podgorica.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Prague.rb +0 -236
- data/lib/tzinfo/definitions/Europe/Riga.rb +0 -222
- data/lib/tzinfo/definitions/Europe/Rome.rb +0 -261
- data/lib/tzinfo/definitions/Europe/Samara.rb +0 -85
- data/lib/tzinfo/definitions/Europe/San_Marino.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Sarajevo.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Saratov.rb +0 -84
- data/lib/tzinfo/definitions/Europe/Simferopol.rb +0 -99
- data/lib/tzinfo/definitions/Europe/Skopje.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Sofia.rb +0 -219
- data/lib/tzinfo/definitions/Europe/Stockholm.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Tallinn.rb +0 -218
- data/lib/tzinfo/definitions/Europe/Tirane.rb +0 -223
- data/lib/tzinfo/definitions/Europe/Tiraspol.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Ulyanovsk.rb +0 -88
- data/lib/tzinfo/definitions/Europe/Uzhgorod.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Vaduz.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Vatican.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Vienna.rb +0 -229
- data/lib/tzinfo/definitions/Europe/Vilnius.rb +0 -216
- data/lib/tzinfo/definitions/Europe/Volgograd.rb +0 -87
- data/lib/tzinfo/definitions/Europe/Warsaw.rb +0 -258
- data/lib/tzinfo/definitions/Europe/Zagreb.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Zaporozhye.rb +0 -13
- data/lib/tzinfo/definitions/Europe/Zurich.rb +0 -211
- data/lib/tzinfo/definitions/Factory.rb +0 -14
- data/lib/tzinfo/definitions/GB.rb +0 -11
- data/lib/tzinfo/definitions/GB__m__Eire.rb +0 -11
- data/lib/tzinfo/definitions/GMT.rb +0 -11
- data/lib/tzinfo/definitions/GMT0.rb +0 -11
- data/lib/tzinfo/definitions/GMT__m__0.rb +0 -11
- data/lib/tzinfo/definitions/GMT__p__0.rb +0 -11
- data/lib/tzinfo/definitions/Greenwich.rb +0 -11
- data/lib/tzinfo/definitions/HST.rb +0 -14
- data/lib/tzinfo/definitions/Hongkong.rb +0 -11
- data/lib/tzinfo/definitions/Iceland.rb +0 -11
- data/lib/tzinfo/definitions/Indian/Antananarivo.rb +0 -13
- data/lib/tzinfo/definitions/Indian/Chagos.rb +0 -20
- data/lib/tzinfo/definitions/Indian/Christmas.rb +0 -13
- data/lib/tzinfo/definitions/Indian/Cocos.rb +0 -13
- data/lib/tzinfo/definitions/Indian/Comoro.rb +0 -13
- data/lib/tzinfo/definitions/Indian/Kerguelen.rb +0 -13
- data/lib/tzinfo/definitions/Indian/Mahe.rb +0 -13
- data/lib/tzinfo/definitions/Indian/Maldives.rb +0 -20
- data/lib/tzinfo/definitions/Indian/Mauritius.rb +0 -23
- data/lib/tzinfo/definitions/Indian/Mayotte.rb +0 -13
- data/lib/tzinfo/definitions/Indian/Reunion.rb +0 -13
- data/lib/tzinfo/definitions/Iran.rb +0 -11
- data/lib/tzinfo/definitions/Israel.rb +0 -11
- data/lib/tzinfo/definitions/Jamaica.rb +0 -11
- data/lib/tzinfo/definitions/Japan.rb +0 -11
- data/lib/tzinfo/definitions/Kwajalein.rb +0 -11
- data/lib/tzinfo/definitions/Libya.rb +0 -11
- data/lib/tzinfo/definitions/MET.rb +0 -223
- data/lib/tzinfo/definitions/MST.rb +0 -14
- data/lib/tzinfo/definitions/MST7MDT.rb +0 -238
- data/lib/tzinfo/definitions/Mexico/BajaNorte.rb +0 -13
- data/lib/tzinfo/definitions/Mexico/BajaSur.rb +0 -13
- data/lib/tzinfo/definitions/Mexico/General.rb +0 -13
- data/lib/tzinfo/definitions/NZ.rb +0 -11
- data/lib/tzinfo/definitions/NZ__m__CHAT.rb +0 -11
- data/lib/tzinfo/definitions/Navajo.rb +0 -11
- data/lib/tzinfo/definitions/PRC.rb +0 -11
- data/lib/tzinfo/definitions/PST8PDT.rb +0 -238
- data/lib/tzinfo/definitions/Pacific/Apia.rb +0 -48
- data/lib/tzinfo/definitions/Pacific/Auckland.rb +0 -248
- data/lib/tzinfo/definitions/Pacific/Bougainville.rb +0 -25
- data/lib/tzinfo/definitions/Pacific/Chatham.rb +0 -219
- data/lib/tzinfo/definitions/Pacific/Chuuk.rb +0 -13
- data/lib/tzinfo/definitions/Pacific/Easter.rb +0 -231
- data/lib/tzinfo/definitions/Pacific/Efate.rb +0 -41
- data/lib/tzinfo/definitions/Pacific/Enderbury.rb +0 -13
- data/lib/tzinfo/definitions/Pacific/Fakaofo.rb +0 -20
- data/lib/tzinfo/definitions/Pacific/Fiji.rb +0 -47
- data/lib/tzinfo/definitions/Pacific/Funafuti.rb +0 -13
- data/lib/tzinfo/definitions/Pacific/Galapagos.rb +0 -23
- data/lib/tzinfo/definitions/Pacific/Gambier.rb +0 -18
- data/lib/tzinfo/definitions/Pacific/Guadalcanal.rb +0 -18
- data/lib/tzinfo/definitions/Pacific/Guam.rb +0 -42
- data/lib/tzinfo/definitions/Pacific/Honolulu.rb +0 -28
- data/lib/tzinfo/definitions/Pacific/Johnston.rb +0 -13
- data/lib/tzinfo/definitions/Pacific/Kanton.rb +0 -22
- data/lib/tzinfo/definitions/Pacific/Kiritimati.rb +0 -22
- data/lib/tzinfo/definitions/Pacific/Kosrae.rb +0 -30
- data/lib/tzinfo/definitions/Pacific/Kwajalein.rb +0 -27
- data/lib/tzinfo/definitions/Pacific/Majuro.rb +0 -13
- data/lib/tzinfo/definitions/Pacific/Marquesas.rb +0 -18
- data/lib/tzinfo/definitions/Pacific/Midway.rb +0 -13
- data/lib/tzinfo/definitions/Pacific/Nauru.rb +0 -23
- data/lib/tzinfo/definitions/Pacific/Niue.rb +0 -20
- data/lib/tzinfo/definitions/Pacific/Norfolk.rb +0 -134
- data/lib/tzinfo/definitions/Pacific/Noumea.rb +0 -25
- data/lib/tzinfo/definitions/Pacific/Pago_Pago.rb +0 -20
- data/lib/tzinfo/definitions/Pacific/Palau.rb +0 -20
- data/lib/tzinfo/definitions/Pacific/Pitcairn.rb +0 -20
- data/lib/tzinfo/definitions/Pacific/Pohnpei.rb +0 -13
- data/lib/tzinfo/definitions/Pacific/Ponape.rb +0 -13
- data/lib/tzinfo/definitions/Pacific/Port_Moresby.rb +0 -20
- data/lib/tzinfo/definitions/Pacific/Rarotonga.rb +0 -48
- data/lib/tzinfo/definitions/Pacific/Saipan.rb +0 -13
- data/lib/tzinfo/definitions/Pacific/Samoa.rb +0 -13
- data/lib/tzinfo/definitions/Pacific/Tahiti.rb +0 -18
- data/lib/tzinfo/definitions/Pacific/Tarawa.rb +0 -18
- data/lib/tzinfo/definitions/Pacific/Tongatapu.rb +0 -29
- data/lib/tzinfo/definitions/Pacific/Truk.rb +0 -13
- data/lib/tzinfo/definitions/Pacific/Wake.rb +0 -13
- data/lib/tzinfo/definitions/Pacific/Wallis.rb +0 -13
- data/lib/tzinfo/definitions/Pacific/Yap.rb +0 -13
- data/lib/tzinfo/definitions/Poland.rb +0 -11
- data/lib/tzinfo/definitions/Portugal.rb +0 -11
- data/lib/tzinfo/definitions/ROC.rb +0 -11
- data/lib/tzinfo/definitions/ROK.rb +0 -11
- data/lib/tzinfo/definitions/Singapore.rb +0 -11
- data/lib/tzinfo/definitions/Turkey.rb +0 -11
- data/lib/tzinfo/definitions/UCT.rb +0 -11
- data/lib/tzinfo/definitions/US/Alaska.rb +0 -13
- data/lib/tzinfo/definitions/US/Aleutian.rb +0 -13
- data/lib/tzinfo/definitions/US/Arizona.rb +0 -13
- data/lib/tzinfo/definitions/US/Central.rb +0 -13
- data/lib/tzinfo/definitions/US/East__m__Indiana.rb +0 -13
- data/lib/tzinfo/definitions/US/Eastern.rb +0 -13
- data/lib/tzinfo/definitions/US/Hawaii.rb +0 -13
- data/lib/tzinfo/definitions/US/Indiana__m__Starke.rb +0 -13
- data/lib/tzinfo/definitions/US/Michigan.rb +0 -13
- data/lib/tzinfo/definitions/US/Mountain.rb +0 -13
- data/lib/tzinfo/definitions/US/Pacific.rb +0 -13
- data/lib/tzinfo/definitions/US/Samoa.rb +0 -13
- data/lib/tzinfo/definitions/UTC.rb +0 -11
- data/lib/tzinfo/definitions/Universal.rb +0 -11
- data/lib/tzinfo/definitions/WET.rb +0 -209
- data/lib/tzinfo/definitions/W__m__SU.rb +0 -11
- data/lib/tzinfo/definitions/Zulu.rb +0 -11
- data/lib/tzinfo/indexes/countries.rb +0 -924
- data/lib/tzinfo/indexes/timezones.rb +0 -607
- data/lib/tzinfo/tzdataparser.rb +0 -1287
- data/test/in_load_path/payload.rb +0 -1
- data/tzinfo.gemspec +0 -19
data/lib/tzinfo/tzdataparser.rb
DELETED
@@ -1,1287 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright (c) 2005-2018 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 'date'
|
24
|
-
require 'fileutils'
|
25
|
-
|
26
|
-
module TZInfo
|
27
|
-
|
28
|
-
# Utility methods used by TZDataParser and associated classes.
|
29
|
-
#
|
30
|
-
# @private
|
31
|
-
module TZDataParserUtils #:nodoc:
|
32
|
-
|
33
|
-
begin
|
34
|
-
Encoding
|
35
|
-
SUPPORTS_ENCODING = true
|
36
|
-
rescue NameError
|
37
|
-
SUPPORTS_ENCODING = false
|
38
|
-
end
|
39
|
-
|
40
|
-
if SUPPORTS_ENCODING
|
41
|
-
def open_file(file_name, mode, opts, &block)
|
42
|
-
File.open(file_name, mode, opts, &block)
|
43
|
-
end
|
44
|
-
else
|
45
|
-
def open_file(file_name, mode, opts, &block)
|
46
|
-
File.open(file_name, mode, &block)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
private :open_file
|
51
|
-
end
|
52
|
-
|
53
|
-
# Parses tzdata from ftp://elsie.nci.nih.gov/pub/ and transforms it into
|
54
|
-
# a set of Ruby modules that can be used through Timezone and Country.
|
55
|
-
#
|
56
|
-
# Normally, this class wouldn't be used. It is only run to update the
|
57
|
-
# timezone data and index modules.
|
58
|
-
class TZDataParser
|
59
|
-
include TZDataParserUtils
|
60
|
-
|
61
|
-
# Minimum year that will be considered.
|
62
|
-
MIN_YEAR = 1800
|
63
|
-
|
64
|
-
# Maximum year that will be considered.
|
65
|
-
MAX_YEAR = 2073
|
66
|
-
|
67
|
-
# Whether to generate zone definitions (set to false to stop zones being
|
68
|
-
# generated).
|
69
|
-
attr_accessor :generate_zones
|
70
|
-
|
71
|
-
# Whether to generate country definitions (set to false to stop countries
|
72
|
-
# being generated).
|
73
|
-
attr_accessor :generate_countries
|
74
|
-
|
75
|
-
# Limit the set of zones to generate (set to an array containing zone
|
76
|
-
# identifiers).
|
77
|
-
attr_accessor :only_zones
|
78
|
-
|
79
|
-
# Zones to exclude from generation when not using only_zones (set to an
|
80
|
-
# array containing zone identifiers).
|
81
|
-
attr_accessor :exclude_zones
|
82
|
-
|
83
|
-
# Initializes a new TZDataParser. input_dir must contain the extracted
|
84
|
-
# tzdata tarball. output_dir is the location to output the modules
|
85
|
-
# (in definitions and indexes directories).
|
86
|
-
def initialize(input_dir, output_dir)
|
87
|
-
super()
|
88
|
-
@input_dir = input_dir
|
89
|
-
@output_dir = output_dir
|
90
|
-
@rule_sets = {}
|
91
|
-
@zones = {}
|
92
|
-
@countries = {}
|
93
|
-
@no_rules = TZDataNoRules.new
|
94
|
-
@generate_zones = true
|
95
|
-
@generate_countries = true
|
96
|
-
@only_zones = []
|
97
|
-
@exclude_zones = []
|
98
|
-
end
|
99
|
-
|
100
|
-
# Reads the tzdata source and generates the classes. Takes a long time
|
101
|
-
# to run. Currently outputs debugging information to standard out.
|
102
|
-
def execute
|
103
|
-
# Note that the backzone file is ignored. backzone contains alternative
|
104
|
-
# definitions of certain zones, primarily for pre-1970 data. It is not
|
105
|
-
# recommended for ordinary use and the tzdata Makefile does not
|
106
|
-
# install its entries by default.
|
107
|
-
|
108
|
-
files = Dir.entries(@input_dir).select do |file|
|
109
|
-
file =~ /\A[^\.]+\z/ &&
|
110
|
-
!%w(backzone calendars leapseconds version CONTRIBUTING LICENSE Makefile NEWS README SECURITY SOURCE Theory version).include?(file) &&
|
111
|
-
File.file?(File.join(@input_dir, file))
|
112
|
-
end
|
113
|
-
|
114
|
-
files.each {|file| load_rules(file) }
|
115
|
-
files.each {|file| load_zones(file) }
|
116
|
-
files.each {|file| load_links(file) }
|
117
|
-
|
118
|
-
load_countries
|
119
|
-
|
120
|
-
if @generate_zones
|
121
|
-
modules = []
|
122
|
-
|
123
|
-
if @only_zones.nil? || @only_zones.empty?
|
124
|
-
@zones.each_value {|zone|
|
125
|
-
zone.write_module(@output_dir) unless @exclude_zones.include?(zone.name)
|
126
|
-
}
|
127
|
-
else
|
128
|
-
@only_zones.each {|id|
|
129
|
-
zone = @zones[id]
|
130
|
-
zone.write_module(@output_dir)
|
131
|
-
}
|
132
|
-
end
|
133
|
-
|
134
|
-
write_timezones_index
|
135
|
-
end
|
136
|
-
|
137
|
-
if @generate_countries
|
138
|
-
write_countries_index
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
# Parses a month specified in the tz data and converts it to a number
|
143
|
-
# between 1 and 12 representing January to December.
|
144
|
-
def self.parse_month(month)
|
145
|
-
lower = month.downcase
|
146
|
-
if lower =~ /^jan/
|
147
|
-
@month = 1
|
148
|
-
elsif lower =~ /^feb/
|
149
|
-
@month = 2
|
150
|
-
elsif lower =~ /^mar/
|
151
|
-
@month = 3
|
152
|
-
elsif lower =~ /^apr/
|
153
|
-
@month = 4
|
154
|
-
elsif lower =~ /^may/
|
155
|
-
@month = 5
|
156
|
-
elsif lower =~ /^jun/
|
157
|
-
@month = 6
|
158
|
-
elsif lower =~ /^jul/
|
159
|
-
@month = 7
|
160
|
-
elsif lower =~ /^aug/
|
161
|
-
@month = 8
|
162
|
-
elsif lower =~ /^sep/
|
163
|
-
@month = 9
|
164
|
-
elsif lower =~ /^oct/
|
165
|
-
@month = 10
|
166
|
-
elsif lower =~ /^nov/
|
167
|
-
@month = 11
|
168
|
-
elsif lower =~ /^dec/
|
169
|
-
@month = 12
|
170
|
-
else
|
171
|
-
raise "Invalid month: #{month}"
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
# Parses an offset string [-]h:m:s (minutes and seconds are optional). Returns
|
176
|
-
# the offset in seconds.
|
177
|
-
def self.parse_offset(offset)
|
178
|
-
raise "Invalid time: #{offset}" if offset !~ /^(-)?(?:([0-9]+)(?::([0-9]+)(?::([0-9]+))?)?)?$/
|
179
|
-
|
180
|
-
negative = !$1.nil?
|
181
|
-
hour = $2.nil? ? 0 : $2.to_i
|
182
|
-
minute = $3.nil? ? 0 : $3.to_i
|
183
|
-
second = $4.nil? ? 0 : $4.to_i
|
184
|
-
|
185
|
-
seconds = hour
|
186
|
-
seconds = seconds * 60
|
187
|
-
seconds = seconds + minute
|
188
|
-
seconds = seconds * 60
|
189
|
-
seconds = seconds + second
|
190
|
-
seconds = -seconds if negative
|
191
|
-
seconds
|
192
|
-
end
|
193
|
-
|
194
|
-
# Encloses the string in single quotes and escapes any single quotes in
|
195
|
-
# the content.
|
196
|
-
def self.quote_str(str)
|
197
|
-
"'#{str.gsub('\'', '\\\\\'')}'"
|
198
|
-
end
|
199
|
-
|
200
|
-
private
|
201
|
-
# Loads all the Rule definitions from the tz data and stores them in
|
202
|
-
# @rule_sets.
|
203
|
-
def load_rules(file)
|
204
|
-
puts 'load_rules: ' + file
|
205
|
-
|
206
|
-
open_file(File.join(@input_dir, file), 'r', :external_encoding => 'UTF-8', :internal_encoding => 'UTF-8') do |file|
|
207
|
-
file.each_line do |line|
|
208
|
-
line = line.gsub(/#.*$/, '')
|
209
|
-
line = line.gsub(/\s+$/, '')
|
210
|
-
|
211
|
-
if line =~ /^Rule\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)/
|
212
|
-
|
213
|
-
name = $1
|
214
|
-
|
215
|
-
if @rule_sets[name].nil?
|
216
|
-
@rule_sets[name] = TZDataRuleSet.new(name)
|
217
|
-
end
|
218
|
-
|
219
|
-
@rule_sets[name].add_rule(TZDataRule.new($2, $3, $4, $5, $6, $7, $8, $9))
|
220
|
-
end
|
221
|
-
end
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
# Gets a rules object for the given reference. Might be a named rule set,
|
226
|
-
# a fixed offset or an empty ruleset.
|
227
|
-
def get_rules(ref)
|
228
|
-
if ref == '-'
|
229
|
-
@no_rules
|
230
|
-
elsif ref =~ /^-?[0-9]+:[0-9]+$/
|
231
|
-
TZDataFixedOffsetRules.new(TZDataParser.parse_offset(ref))
|
232
|
-
else
|
233
|
-
rule_set = @rule_sets[ref]
|
234
|
-
raise "Ruleset not found: #{ref}" if rule_set.nil?
|
235
|
-
rule_set
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
# Loads in the Zone definitions from the tz data and stores them in @zones.
|
240
|
-
def load_zones(file)
|
241
|
-
puts 'load_zones: ' + file
|
242
|
-
|
243
|
-
in_zone = nil
|
244
|
-
|
245
|
-
open_file(File.join(@input_dir, file), 'r', :external_encoding => 'UTF-8', :internal_encoding => 'UTF-8') do |file|
|
246
|
-
file.each_line do |line|
|
247
|
-
line = line.gsub(/#.*$/, '')
|
248
|
-
line = line.gsub(/\s+$/, '')
|
249
|
-
|
250
|
-
if in_zone
|
251
|
-
if line =~ /^\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)(\s+([0-9]+(\s+.*)?))?$/
|
252
|
-
|
253
|
-
in_zone.add_observance(TZDataObservance.new($1, get_rules($2), $3, $5))
|
254
|
-
|
255
|
-
in_zone = nil if $4.nil?
|
256
|
-
end
|
257
|
-
else
|
258
|
-
if line =~ /^Zone\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)(\s+([0-9]+(\s+.*)?))?$/
|
259
|
-
name = $1
|
260
|
-
|
261
|
-
if @zones[name].nil?
|
262
|
-
@zones[name] = TZDataZone.new(name)
|
263
|
-
end
|
264
|
-
|
265
|
-
@zones[name].add_observance(TZDataObservance.new($2, get_rules($3), $4, $6))
|
266
|
-
|
267
|
-
in_zone = @zones[name] if !$5.nil?
|
268
|
-
end
|
269
|
-
end
|
270
|
-
end
|
271
|
-
end
|
272
|
-
end
|
273
|
-
|
274
|
-
# Loads in the links and stores them in @zones.
|
275
|
-
def load_links(file)
|
276
|
-
puts 'load_links: ' + file
|
277
|
-
|
278
|
-
open_file(File.join(@input_dir, file), 'r', :external_encoding => 'UTF-8', :internal_encoding => 'UTF-8') do |file|
|
279
|
-
file.each_line do |line|
|
280
|
-
line = line.gsub(/#.*$/, '')
|
281
|
-
line = line.gsub(/\s+$/, '')
|
282
|
-
|
283
|
-
if line =~ /^Link\s+([^\s]+)\s+([^\s]+)/
|
284
|
-
name = $2
|
285
|
-
link_to = @zones[$1]
|
286
|
-
raise "Link to zone not found (#{name}->#{link_to})" if link_to.nil?
|
287
|
-
raise "Zone already defined: #{name}" if !@zones[name].nil?
|
288
|
-
@zones[name] = TZDataLink.new(name, link_to)
|
289
|
-
end
|
290
|
-
end
|
291
|
-
end
|
292
|
-
end
|
293
|
-
|
294
|
-
# Loads countries from iso3166.tab and zone.tab and stores the result in
|
295
|
-
# @countries.
|
296
|
-
def load_countries
|
297
|
-
puts 'load_countries'
|
298
|
-
|
299
|
-
open_file(File.join(@input_dir, 'iso3166.tab'), 'r', :external_encoding => 'UTF-8', :internal_encoding => 'UTF-8') do |file|
|
300
|
-
file.each_line do |line|
|
301
|
-
if line =~ /^([A-Z]{2})\t(.*)$/
|
302
|
-
code = $1
|
303
|
-
name = $2
|
304
|
-
@countries[code] = TZDataCountry.new(code, name)
|
305
|
-
end
|
306
|
-
end
|
307
|
-
end
|
308
|
-
|
309
|
-
open_file(File.join(@input_dir, 'zone.tab'), 'r', :external_encoding => 'UTF-8', :internal_encoding => 'UTF-8') do |file|
|
310
|
-
file.each_line do |line|
|
311
|
-
line.chomp!
|
312
|
-
if line =~ /^([A-Z]{2})\t([^\t]+)\t([^\t]+)(\t(.*))?$/
|
313
|
-
code = $1
|
314
|
-
location_str = $2
|
315
|
-
zone_name = $3
|
316
|
-
description = $5
|
317
|
-
|
318
|
-
country = @countries[code]
|
319
|
-
raise "Country not found: #{code}" if country.nil?
|
320
|
-
|
321
|
-
location = TZDataLocation.new(location_str)
|
322
|
-
|
323
|
-
zone = @zones[zone_name]
|
324
|
-
raise "Zone not found: #{zone_name}" if zone.nil?
|
325
|
-
|
326
|
-
description = nil if description == ''
|
327
|
-
|
328
|
-
country.add_zone(TZDataCountryTimezone.new(zone, description, location))
|
329
|
-
end
|
330
|
-
end
|
331
|
-
end
|
332
|
-
end
|
333
|
-
|
334
|
-
# Writes a country index file.
|
335
|
-
def write_countries_index
|
336
|
-
dir = @output_dir + File::SEPARATOR + 'indexes'
|
337
|
-
FileUtils.mkdir_p(dir)
|
338
|
-
|
339
|
-
open_file(File.join(dir, 'countries.rb'), 'w', :external_encoding => 'UTF-8', :universal_newline => true) do |file|
|
340
|
-
file.puts('# encoding: UTF-8')
|
341
|
-
file.puts('')
|
342
|
-
|
343
|
-
file.puts('module TZInfo')
|
344
|
-
file.puts(' module Indexes')
|
345
|
-
file.puts(' module Countries')
|
346
|
-
file.puts(' include CountryIndexDefinition')
|
347
|
-
file.puts('')
|
348
|
-
|
349
|
-
countries = @countries.values.sort {|c1,c2| c1.code <=> c2.code}
|
350
|
-
countries.each {|country| country.write_index_record(file)}
|
351
|
-
|
352
|
-
file.puts(' end') # end module Countries
|
353
|
-
file.puts(' end') # end module Indexes
|
354
|
-
file.puts('end') # end module TZInfo
|
355
|
-
end
|
356
|
-
end
|
357
|
-
|
358
|
-
# Writes a timezone index file.
|
359
|
-
def write_timezones_index
|
360
|
-
dir = File.join(@output_dir, 'indexes')
|
361
|
-
FileUtils.mkdir_p(dir)
|
362
|
-
|
363
|
-
open_file(File.join(dir, 'timezones.rb'), 'w', :external_encoding => 'UTF-8', :universal_newline => true) do |file|
|
364
|
-
file.puts('# encoding: UTF-8')
|
365
|
-
file.puts('')
|
366
|
-
|
367
|
-
file.puts('module TZInfo')
|
368
|
-
file.puts(' module Indexes')
|
369
|
-
file.puts(' module Timezones')
|
370
|
-
file.puts(' include TimezoneIndexDefinition')
|
371
|
-
file.puts('')
|
372
|
-
|
373
|
-
zones = @zones.values.sort {|t1,t2| t1.name <=> t2.name}
|
374
|
-
zones.each {|zone| zone.write_index_record(file)}
|
375
|
-
|
376
|
-
file.puts(' end') # end module Timezones
|
377
|
-
file.puts(' end') # end module Indexes
|
378
|
-
file.puts('end') # end module TZInfo
|
379
|
-
end
|
380
|
-
|
381
|
-
end
|
382
|
-
end
|
383
|
-
|
384
|
-
# Base class for all rule sets.
|
385
|
-
#
|
386
|
-
# @private
|
387
|
-
class TZDataRules #:nodoc:
|
388
|
-
# Name of the rule set, e.g. EU.
|
389
|
-
attr_reader :name
|
390
|
-
|
391
|
-
def initialize(name)
|
392
|
-
@name = name
|
393
|
-
end
|
394
|
-
|
395
|
-
def count
|
396
|
-
0
|
397
|
-
end
|
398
|
-
end
|
399
|
-
|
400
|
-
# Empty rule set with a fixed daylight savings (std) offset.
|
401
|
-
#
|
402
|
-
# @private
|
403
|
-
class TZDataFixedOffsetRules < TZDataRules #:nodoc:
|
404
|
-
attr_reader :offset
|
405
|
-
|
406
|
-
def initialize(offset)
|
407
|
-
super(offset.to_s)
|
408
|
-
@offset = offset
|
409
|
-
end
|
410
|
-
end
|
411
|
-
|
412
|
-
# An empty set of rules.
|
413
|
-
#
|
414
|
-
# @private
|
415
|
-
class TZDataNoRules < TZDataRules #:nodoc:
|
416
|
-
def initialize
|
417
|
-
super('-')
|
418
|
-
end
|
419
|
-
end
|
420
|
-
|
421
|
-
# A rule set (as defined by Rule name in the tz data).
|
422
|
-
#
|
423
|
-
# @private
|
424
|
-
class TZDataRuleSet < TZDataRules #:nodoc:
|
425
|
-
attr_reader :rules
|
426
|
-
|
427
|
-
def initialize(name)
|
428
|
-
super
|
429
|
-
@rules = []
|
430
|
-
end
|
431
|
-
|
432
|
-
# Adds a new rule to the set.
|
433
|
-
def add_rule(rule)
|
434
|
-
@rules << rule
|
435
|
-
end
|
436
|
-
|
437
|
-
def count
|
438
|
-
@rules.length
|
439
|
-
end
|
440
|
-
|
441
|
-
def each
|
442
|
-
@rules.each {|rule| yield rule}
|
443
|
-
end
|
444
|
-
end
|
445
|
-
|
446
|
-
# A rule in a RuleSet (a single Rule line in the tz data).
|
447
|
-
#
|
448
|
-
# @private
|
449
|
-
class TZDataRule #:nodoc:
|
450
|
-
attr_reader :from
|
451
|
-
attr_reader :to
|
452
|
-
attr_reader :type
|
453
|
-
attr_reader :in_month
|
454
|
-
attr_reader :on_day
|
455
|
-
attr_reader :at_time
|
456
|
-
attr_reader :save
|
457
|
-
attr_reader :letter
|
458
|
-
|
459
|
-
def initialize(from, to, type, in_month, on_day, at_time, save, letter)
|
460
|
-
@from = parse_from(from)
|
461
|
-
@to = parse_to(to)
|
462
|
-
|
463
|
-
# replace a to of :only with the from year
|
464
|
-
raise 'to cannot be only if from is minimum' if @to == :only && @from == :min
|
465
|
-
@to = @from if @to == :only
|
466
|
-
|
467
|
-
@type = parse_type(type)
|
468
|
-
@in_month = TZDataParser.parse_month(in_month)
|
469
|
-
@on_day = TZDataDayOfMonth.new(on_day)
|
470
|
-
@at_time = TZDataTime.new(at_time)
|
471
|
-
@save = TZDataParser.parse_offset(save)
|
472
|
-
@letter = parse_letter(letter)
|
473
|
-
end
|
474
|
-
|
475
|
-
def activate(year)
|
476
|
-
# The following test ignores yearistype at present (currently unused in
|
477
|
-
# the data. parse_type currently excepts on encountering a year type.
|
478
|
-
if (@from == :min || @from <= year) && (@to == :max || @to >= year)
|
479
|
-
TZDataActivatedRule.new(self, year)
|
480
|
-
else
|
481
|
-
nil
|
482
|
-
end
|
483
|
-
end
|
484
|
-
|
485
|
-
def at_utc_time(year, utc_offset, std_offset)
|
486
|
-
absolute = @on_day.to_absolute(year, @in_month)
|
487
|
-
@at_time.to_utc(utc_offset, std_offset,
|
488
|
-
absolute.year, absolute.month, absolute.day)
|
489
|
-
end
|
490
|
-
|
491
|
-
private
|
492
|
-
def parse_from(from)
|
493
|
-
lower = from.downcase
|
494
|
-
if lower =~ /^min/
|
495
|
-
:min
|
496
|
-
elsif lower =~ /^[0-9]+$/
|
497
|
-
lower.to_i
|
498
|
-
else
|
499
|
-
raise "Invalid from: #{from}"
|
500
|
-
end
|
501
|
-
end
|
502
|
-
|
503
|
-
def parse_to(to)
|
504
|
-
lower = to.downcase
|
505
|
-
if lower =~ /^max/
|
506
|
-
:max
|
507
|
-
elsif lower =~ /^o/
|
508
|
-
:only
|
509
|
-
elsif lower =~ /^[0-9]+$/
|
510
|
-
lower.to_i
|
511
|
-
else
|
512
|
-
raise "Invalid to: #{to}"
|
513
|
-
end
|
514
|
-
end
|
515
|
-
|
516
|
-
def parse_type(type)
|
517
|
-
raise "Unsupported rule type: #{type}" if type != '-'
|
518
|
-
nil
|
519
|
-
end
|
520
|
-
|
521
|
-
def parse_letter(letter)
|
522
|
-
if letter == '-'
|
523
|
-
nil
|
524
|
-
else
|
525
|
-
letter
|
526
|
-
end
|
527
|
-
end
|
528
|
-
end
|
529
|
-
|
530
|
-
# Base class for Zones and Links.
|
531
|
-
#
|
532
|
-
# @private
|
533
|
-
class TZDataDefinition #:nodoc:
|
534
|
-
include TZDataParserUtils
|
535
|
-
|
536
|
-
attr_reader :name
|
537
|
-
attr_reader :name_elements
|
538
|
-
attr_reader :path_elements
|
539
|
-
|
540
|
-
def initialize(name)
|
541
|
-
@name = name
|
542
|
-
|
543
|
-
# + and - aren't allowed in class names
|
544
|
-
@name_elements = name.gsub(/-/, '__m__').gsub(/\+/, '__p__').split(/\//)
|
545
|
-
@path_elements = @name_elements.clone
|
546
|
-
@path_elements.pop
|
547
|
-
end
|
548
|
-
|
549
|
-
# Creates necessary directories, the file, writes the class header and footer
|
550
|
-
# and yields to a block to write the content.
|
551
|
-
def create_file(output_dir)
|
552
|
-
dir = output_dir + File::SEPARATOR + 'definitions' + File::SEPARATOR + @path_elements.join(File::SEPARATOR)
|
553
|
-
FileUtils.mkdir_p(dir)
|
554
|
-
|
555
|
-
open_file(File.join(output_dir, 'definitions', @name_elements.join(File::SEPARATOR)) + '.rb', 'w', :external_encoding => 'UTF-8', :universal_newline => true) do |file|
|
556
|
-
file.binmode
|
557
|
-
|
558
|
-
def file.indent(by)
|
559
|
-
if @tz_indent
|
560
|
-
@tz_indent += by
|
561
|
-
else
|
562
|
-
@tz_indent = by
|
563
|
-
end
|
564
|
-
end
|
565
|
-
|
566
|
-
def file.puts(s)
|
567
|
-
super("#{' ' * (@tz_indent || 0)}#{s}")
|
568
|
-
end
|
569
|
-
|
570
|
-
file.puts('# encoding: UTF-8')
|
571
|
-
file.puts('')
|
572
|
-
file.puts('module TZInfo')
|
573
|
-
file.indent(2)
|
574
|
-
file.puts('module Definitions')
|
575
|
-
file.indent(2)
|
576
|
-
|
577
|
-
@name_elements.each do |part|
|
578
|
-
file.puts("module #{part}")
|
579
|
-
file.indent(2)
|
580
|
-
end
|
581
|
-
|
582
|
-
file.puts('include TimezoneDefinition')
|
583
|
-
file.puts('')
|
584
|
-
|
585
|
-
yield file
|
586
|
-
|
587
|
-
@name_elements.each do
|
588
|
-
file.indent(-2)
|
589
|
-
file.puts('end')
|
590
|
-
end
|
591
|
-
file.indent(-2)
|
592
|
-
file.puts('end') # end module Definitions
|
593
|
-
file.indent(-2)
|
594
|
-
file.puts('end') # end module TZInfo
|
595
|
-
end
|
596
|
-
end
|
597
|
-
end
|
598
|
-
|
599
|
-
# A tz data Link.
|
600
|
-
#
|
601
|
-
# @private
|
602
|
-
class TZDataLink < TZDataDefinition #:nodoc:
|
603
|
-
attr_reader :link_to
|
604
|
-
|
605
|
-
def initialize(name, link_to)
|
606
|
-
super(name)
|
607
|
-
@link_to = link_to
|
608
|
-
end
|
609
|
-
|
610
|
-
# Writes a module for this link.
|
611
|
-
def write_module(output_dir)
|
612
|
-
puts "writing link #{name}"
|
613
|
-
|
614
|
-
create_file(output_dir) {|file|
|
615
|
-
file.puts("linked_timezone #{TZDataParser.quote_str(@name)}, #{TZDataParser.quote_str(@link_to.name)}")
|
616
|
-
}
|
617
|
-
end
|
618
|
-
|
619
|
-
# Writes an index record for this link.
|
620
|
-
def write_index_record(file)
|
621
|
-
file.puts(" linked_timezone #{TZDataParser.quote_str(@name)}")
|
622
|
-
end
|
623
|
-
end
|
624
|
-
|
625
|
-
# A tz data Zone. Each line from the tz data is loaded as a TZDataObservance.
|
626
|
-
#
|
627
|
-
# @private
|
628
|
-
class TZDataZone < TZDataDefinition #:nodoc:
|
629
|
-
attr_reader :observances
|
630
|
-
|
631
|
-
def initialize(name)
|
632
|
-
super
|
633
|
-
@observances = []
|
634
|
-
end
|
635
|
-
|
636
|
-
def add_observance(observance)
|
637
|
-
@observances << observance
|
638
|
-
end
|
639
|
-
|
640
|
-
# Writes the module for the zone. Iterates all the periods and asks them
|
641
|
-
# to write all periods in the timezone.
|
642
|
-
def write_module(output_dir)
|
643
|
-
puts "writing zone #{name}"
|
644
|
-
|
645
|
-
create_file(output_dir) {|file|
|
646
|
-
|
647
|
-
file.puts("timezone #{TZDataParser.quote_str(@name)} do |tz|")
|
648
|
-
file.indent(2)
|
649
|
-
|
650
|
-
transitions = find_transitions
|
651
|
-
transitions.output_module(file)
|
652
|
-
|
653
|
-
file.indent(-2)
|
654
|
-
file.puts('end')
|
655
|
-
}
|
656
|
-
end
|
657
|
-
|
658
|
-
# Writes an index record for this zone.
|
659
|
-
def write_index_record(file)
|
660
|
-
file.puts(" timezone #{TZDataParser.quote_str(@name)}")
|
661
|
-
end
|
662
|
-
|
663
|
-
private
|
664
|
-
def find_transitions
|
665
|
-
transitions = TZDataTransitions.new
|
666
|
-
|
667
|
-
# algorithm from zic.c outzone
|
668
|
-
|
669
|
-
start_time = nil
|
670
|
-
until_time = nil
|
671
|
-
|
672
|
-
|
673
|
-
@observances.each_with_index {|observance, i|
|
674
|
-
std_offset = 0
|
675
|
-
use_start = i > 0
|
676
|
-
use_until = i < @observances.length - 1
|
677
|
-
utc_offset = observance.utc_offset
|
678
|
-
start_zone_id = nil
|
679
|
-
start_utc_offset = observance.utc_offset
|
680
|
-
start_std_offset = 0
|
681
|
-
|
682
|
-
if observance.rule_set.count == 0
|
683
|
-
std_offset = observance.std_offset
|
684
|
-
start_zone_id = observance.format.expand(utc_offset, std_offset, nil)
|
685
|
-
|
686
|
-
if use_start
|
687
|
-
transitions << TZDataTransition.new(start_time, utc_offset, std_offset, start_zone_id)
|
688
|
-
use_start = false
|
689
|
-
else
|
690
|
-
# zic algorithm only outputs this if std_offset is non-zero
|
691
|
-
# to get the initial LMT range, we output this regardless
|
692
|
-
transitions << TZDataTransition.new(nil, utc_offset, std_offset, start_zone_id)
|
693
|
-
end
|
694
|
-
else
|
695
|
-
(TZDataParser::MIN_YEAR..TZDataParser::MAX_YEAR).each {|year|
|
696
|
-
if use_until && year > observance.valid_until.year
|
697
|
-
break
|
698
|
-
end
|
699
|
-
|
700
|
-
activated_rules = []
|
701
|
-
|
702
|
-
observance.rule_set.each {|rule|
|
703
|
-
activated_rule = rule.activate(year)
|
704
|
-
activated_rules << activated_rule unless activated_rule.nil?
|
705
|
-
}
|
706
|
-
|
707
|
-
while true
|
708
|
-
# turn until_time into UTC using the current utc_offset and std_offset
|
709
|
-
until_time = observance.valid_until.to_utc(utc_offset, std_offset) if use_until
|
710
|
-
|
711
|
-
earliest = nil
|
712
|
-
|
713
|
-
activated_rules.each {|activated_rule|
|
714
|
-
# recalculate the time using the current std_offset
|
715
|
-
activated_rule.calculate_time(utc_offset, std_offset)
|
716
|
-
earliest = activated_rule if earliest.nil? || activated_rule.at < earliest.at
|
717
|
-
}
|
718
|
-
|
719
|
-
break if earliest.nil?
|
720
|
-
activated_rules.delete(earliest)
|
721
|
-
break if use_until && earliest.at >= until_time
|
722
|
-
std_offset = earliest.rule.save
|
723
|
-
use_start = false if use_start && earliest.at == start_time
|
724
|
-
|
725
|
-
if use_start
|
726
|
-
if earliest.at < start_time
|
727
|
-
start_utc_offset = observance.utc_offset
|
728
|
-
start_std_offset = std_offset
|
729
|
-
start_zone_id = observance.format.expand(start_utc_offset, earliest.rule.save, earliest.rule.letter)
|
730
|
-
next
|
731
|
-
end
|
732
|
-
|
733
|
-
if start_zone_id.nil? && start_utc_offset + start_std_offset == observance.utc_offset + std_offset
|
734
|
-
start_zone_id = observance.format.expand(start_utc_offset, earliest.rule.save, earliest.rule.letter)
|
735
|
-
end
|
736
|
-
end
|
737
|
-
|
738
|
-
zone_id = observance.format.expand(observance.utc_offset, earliest.rule.save, earliest.rule.letter)
|
739
|
-
transitions << TZDataTransition.new(earliest.at, observance.utc_offset, earliest.rule.save, zone_id)
|
740
|
-
end
|
741
|
-
}
|
742
|
-
end
|
743
|
-
|
744
|
-
if use_start
|
745
|
-
start_zone_id = observance.format.expand(nil, nil, nil) if start_zone_id.nil? && observance.format.fixed?
|
746
|
-
raise 'Could not determine time zone abbreviation to use just after until time' if start_zone_id.nil?
|
747
|
-
transitions << TZDataTransition.new(start_time, start_utc_offset, start_std_offset, start_zone_id)
|
748
|
-
end
|
749
|
-
|
750
|
-
start_time = observance.valid_until.to_utc(utc_offset, std_offset) if use_until
|
751
|
-
}
|
752
|
-
|
753
|
-
transitions
|
754
|
-
end
|
755
|
-
end
|
756
|
-
|
757
|
-
# A observance within a zone (a line within the zone definition).
|
758
|
-
#
|
759
|
-
# @private
|
760
|
-
class TZDataObservance #:nodoc:
|
761
|
-
attr_reader :utc_offset
|
762
|
-
attr_reader :rule_set
|
763
|
-
attr_reader :format
|
764
|
-
attr_reader :valid_until
|
765
|
-
|
766
|
-
def initialize(utc_offset, rule_set, format, valid_until)
|
767
|
-
@utc_offset = TZDataParser.parse_offset(utc_offset)
|
768
|
-
@rule_set = rule_set
|
769
|
-
@format = TZDataFormat.new(format)
|
770
|
-
@valid_until = valid_until.nil? ? nil : TZDataUntil.new(valid_until)
|
771
|
-
end
|
772
|
-
|
773
|
-
def std_offset
|
774
|
-
if @rule_set.kind_of?(TZDataFixedOffsetRules)
|
775
|
-
@rule_set.offset
|
776
|
-
else
|
777
|
-
0
|
778
|
-
end
|
779
|
-
end
|
780
|
-
end
|
781
|
-
|
782
|
-
# Collection of TZDataTransition instances used when building a zone class.
|
783
|
-
#
|
784
|
-
# @private
|
785
|
-
class TZDataTransitions #:nodoc:
|
786
|
-
|
787
|
-
def initialize
|
788
|
-
@transitions = []
|
789
|
-
end
|
790
|
-
|
791
|
-
def << (transition)
|
792
|
-
@transitions << transition
|
793
|
-
end
|
794
|
-
|
795
|
-
def output_module(file)
|
796
|
-
optimize
|
797
|
-
|
798
|
-
# Try and end on a transition to std if one happens in the last year.
|
799
|
-
if @transitions.length > 1 &&
|
800
|
-
@transitions.last.std_offset != 0 &&
|
801
|
-
@transitions[@transitions.length - 2].std_offset == 0 &&
|
802
|
-
@transitions[@transitions.length - 2].at_utc.year == TZDataParser::MAX_YEAR
|
803
|
-
|
804
|
-
transitions = @transitions[0..@transitions.length - 2]
|
805
|
-
else
|
806
|
-
transitions = @transitions
|
807
|
-
end
|
808
|
-
|
809
|
-
process_offsets(file)
|
810
|
-
file.puts('')
|
811
|
-
|
812
|
-
transitions.each do |t|
|
813
|
-
t.write(file)
|
814
|
-
end
|
815
|
-
end
|
816
|
-
|
817
|
-
private
|
818
|
-
def optimize
|
819
|
-
@transitions.sort!
|
820
|
-
|
821
|
-
# Optimization logic from zic.c writezone.
|
822
|
-
|
823
|
-
from_i = 0
|
824
|
-
to_i = 0
|
825
|
-
|
826
|
-
while from_i < @transitions.length
|
827
|
-
if to_i > 1 &&
|
828
|
-
!@transitions[from_i].at_utc.nil? &&
|
829
|
-
!@transitions[to_i - 1].at_utc.nil? &&
|
830
|
-
@transitions[from_i].at_utc + Rational(@transitions[to_i - 1].total_offset, 86400) <=
|
831
|
-
@transitions[to_i - 1].at_utc + Rational(@transitions[to_i - 2].total_offset, 86400)
|
832
|
-
|
833
|
-
@transitions[to_i - 1] = @transitions[from_i].clone_with_at(@transitions[to_i - 1].at_utc)
|
834
|
-
from_i += 1
|
835
|
-
next
|
836
|
-
end
|
837
|
-
|
838
|
-
# Shuffle transitions up, eliminating any redundant transitions
|
839
|
-
# along the way.
|
840
|
-
if to_i == 0 ||
|
841
|
-
@transitions[to_i - 1].utc_offset != @transitions[from_i].utc_offset ||
|
842
|
-
@transitions[to_i - 1].std_offset != @transitions[from_i].std_offset ||
|
843
|
-
@transitions[to_i - 1].zone_id != @transitions[from_i].zone_id
|
844
|
-
|
845
|
-
@transitions[to_i] = @transitions[from_i]
|
846
|
-
to_i += 1
|
847
|
-
end
|
848
|
-
|
849
|
-
from_i += 1
|
850
|
-
end
|
851
|
-
|
852
|
-
if to_i > 0
|
853
|
-
@transitions = @transitions[0..to_i - 1]
|
854
|
-
else
|
855
|
-
@transitions = []
|
856
|
-
end
|
857
|
-
end
|
858
|
-
|
859
|
-
def quote_zone_id(zone_id)
|
860
|
-
if zone_id =~ %r{[\-+']}
|
861
|
-
":#{TZDataParser.quote_str(zone_id)}"
|
862
|
-
else
|
863
|
-
":#{zone_id}"
|
864
|
-
end
|
865
|
-
end
|
866
|
-
|
867
|
-
def process_offsets(file)
|
868
|
-
# A bit of a hack at the moment. The offset used to be output with
|
869
|
-
# each period (pair of transitions). They are now separated from the
|
870
|
-
# transition data. The code should probably be changed at some point to
|
871
|
-
# setup the offsets at an earlier stage.
|
872
|
-
|
873
|
-
# Assume that when this is called, the first transition is the Local
|
874
|
-
# Mean Time initial rule or a transition with no time that defines the
|
875
|
-
# offset for the entire zone.
|
876
|
-
|
877
|
-
offsets = []
|
878
|
-
|
879
|
-
# Find the first std offset. Timezones always start in std.
|
880
|
-
@transitions.each do |t|
|
881
|
-
if t.std_offset == 0
|
882
|
-
offset = {:utc_offset => t.utc_offset,
|
883
|
-
:std_offset => t.std_offset,
|
884
|
-
:zone_id => t.zone_id,
|
885
|
-
:name => 'o0'}
|
886
|
-
|
887
|
-
offsets << offset
|
888
|
-
break
|
889
|
-
end
|
890
|
-
end
|
891
|
-
|
892
|
-
@transitions.each do |t|
|
893
|
-
offset = offsets.find do |o|
|
894
|
-
o[:utc_offset] == t.utc_offset &&
|
895
|
-
o[:std_offset] == t.std_offset &&
|
896
|
-
o[:zone_id] == t.zone_id
|
897
|
-
end
|
898
|
-
|
899
|
-
unless offset
|
900
|
-
offset = {:utc_offset => t.utc_offset,
|
901
|
-
:std_offset => t.std_offset,
|
902
|
-
:zone_id => t.zone_id,
|
903
|
-
:name => "o#{offsets.length}"}
|
904
|
-
|
905
|
-
offsets << offset
|
906
|
-
end
|
907
|
-
|
908
|
-
t.offset_name = offset[:name]
|
909
|
-
end
|
910
|
-
|
911
|
-
offsets.each do |offset|
|
912
|
-
file.puts("tz.offset :#{offset[:name]}, #{offset[:utc_offset]}, #{offset[:std_offset]}, #{quote_zone_id(offset[:zone_id])}")
|
913
|
-
end
|
914
|
-
|
915
|
-
end
|
916
|
-
end
|
917
|
-
|
918
|
-
# A transition that will be used to write the periods in a zone class.
|
919
|
-
#
|
920
|
-
# @private
|
921
|
-
class TZDataTransition #:nodoc:
|
922
|
-
include Comparable
|
923
|
-
|
924
|
-
attr_reader :at_utc
|
925
|
-
attr_reader :utc_offset
|
926
|
-
attr_reader :std_offset
|
927
|
-
attr_reader :zone_id
|
928
|
-
attr_accessor :offset_name
|
929
|
-
|
930
|
-
def initialize(at_utc, utc_offset, std_offset, zone_id)
|
931
|
-
@at_utc = at_utc
|
932
|
-
@utc_offset = utc_offset
|
933
|
-
@std_offset = std_offset
|
934
|
-
@zone_id = zone_id
|
935
|
-
@offset_name = nil
|
936
|
-
end
|
937
|
-
|
938
|
-
def to_s
|
939
|
-
"At #{at_utc} UTC switch to UTC offset #{@utc_offset} with std offset #{@std_offset}, zone id #{@zone_id}"
|
940
|
-
end
|
941
|
-
|
942
|
-
def <=>(transition)
|
943
|
-
if @at_utc == transition.at_utc
|
944
|
-
0
|
945
|
-
elsif @at_utc.nil?
|
946
|
-
-1
|
947
|
-
elsif transition.nil?
|
948
|
-
1
|
949
|
-
else
|
950
|
-
@at_utc - transition.at_utc
|
951
|
-
end
|
952
|
-
end
|
953
|
-
|
954
|
-
def total_offset
|
955
|
-
@utc_offset + @std_offset
|
956
|
-
end
|
957
|
-
|
958
|
-
def clone_with_at(at_utc)
|
959
|
-
TZDataTransition.new(at_utc, @utc_offset, @std_offset, @zone_id)
|
960
|
-
end
|
961
|
-
|
962
|
-
def write(file)
|
963
|
-
if @at_utc
|
964
|
-
file.puts "tz.transition #{@at_utc.year}, #{@at_utc.mon}, :#{@offset_name}, #{datetime_constructor(@at_utc)}"
|
965
|
-
end
|
966
|
-
end
|
967
|
-
|
968
|
-
private
|
969
|
-
def datetime_constructor(datetime)
|
970
|
-
if (1970..2037).include?(datetime.year)
|
971
|
-
"#{Time.utc(datetime.year, datetime.mon, datetime.mday, datetime.hour, datetime.min, datetime.sec).to_i}"
|
972
|
-
else
|
973
|
-
"#{datetime.ajd.numerator}, #{datetime.ajd.denominator}"
|
974
|
-
end
|
975
|
-
end
|
976
|
-
end
|
977
|
-
|
978
|
-
# An instance of a rule for a year.
|
979
|
-
#
|
980
|
-
# @private
|
981
|
-
class TZDataActivatedRule #:nodoc:
|
982
|
-
attr_reader :rule
|
983
|
-
attr_reader :year
|
984
|
-
attr_reader :at
|
985
|
-
|
986
|
-
def initialize(rule, year)
|
987
|
-
@rule = rule
|
988
|
-
@year = year
|
989
|
-
@at = nil
|
990
|
-
end
|
991
|
-
|
992
|
-
def calculate_time(utc_offset, std_offset)
|
993
|
-
@at = @rule.at_utc_time(@year, utc_offset, std_offset)
|
994
|
-
end
|
995
|
-
end
|
996
|
-
|
997
|
-
# A tz data time definition - a sign (1 or -1), hour, minute, second and
|
998
|
-
# reference (:utc, :standard or :wall_clock).
|
999
|
-
#
|
1000
|
-
# @private
|
1001
|
-
class TZDataTime #:nodoc:
|
1002
|
-
attr_reader :hour
|
1003
|
-
attr_reader :minute
|
1004
|
-
attr_reader :second
|
1005
|
-
attr_reader :ref
|
1006
|
-
|
1007
|
-
def initialize(spec)
|
1008
|
-
raise "Invalid time: #{spec}" if spec !~ /^(-?)([0-9]+)(:([0-9]+)(:([0-9]+))?)?([wguzs])?$/
|
1009
|
-
|
1010
|
-
@sign = $1 == '-' ? -1 : 1
|
1011
|
-
@hour = $2.to_i
|
1012
|
-
@minute = $4.nil? ? 0 : $4.to_i
|
1013
|
-
@second = $6.nil? ? 0 : $6.to_i
|
1014
|
-
|
1015
|
-
if $7 == 's'
|
1016
|
-
@ref = :standard
|
1017
|
-
elsif $7 == 'g' || $7 == 'u' || $7 == 'z'
|
1018
|
-
@ref = :utc
|
1019
|
-
else
|
1020
|
-
@ref = :wall_clock
|
1021
|
-
end
|
1022
|
-
end
|
1023
|
-
|
1024
|
-
# Converts the time to UTC given a utc_offset and std_offset.
|
1025
|
-
def to_utc(utc_offset, std_offset, year, month, day)
|
1026
|
-
result = if @hour > 24 || @hour == 24 && (@minute > 0 || @second > 0) || @sign != 1
|
1027
|
-
DateTime.new(year, month, day, 0, 0, 0) + Rational(@sign * (@second + (@minute + @hour * 60) * 60), 86400)
|
1028
|
-
else
|
1029
|
-
DateTime.new(year, month, day, @hour, @minute, @second)
|
1030
|
-
end
|
1031
|
-
|
1032
|
-
offset = 0
|
1033
|
-
offset = offset + utc_offset if @ref == :standard || @ref == :wall_clock
|
1034
|
-
offset = offset + std_offset if @ref == :wall_clock
|
1035
|
-
result - Rational(offset, 86400)
|
1036
|
-
end
|
1037
|
-
end
|
1038
|
-
|
1039
|
-
# A tz data day of the month reference. Can either be an absolute day,
|
1040
|
-
# a last week day or a week day >= or <= than a specific day of month. Can
|
1041
|
-
# result in a day in the neighbouring month.
|
1042
|
-
#
|
1043
|
-
# @private
|
1044
|
-
class TZDataDayOfMonth #:nodoc:
|
1045
|
-
attr_reader :type
|
1046
|
-
attr_reader :day_of_month
|
1047
|
-
attr_reader :day_of_week
|
1048
|
-
attr_reader :operator
|
1049
|
-
|
1050
|
-
def initialize(spec)
|
1051
|
-
raise "Invalid on: #{spec}" if spec !~ /^([0-9]+)|(last([A-z]+))|(([A-z]+)([<>]=)([0-9]+))$/
|
1052
|
-
|
1053
|
-
if $1
|
1054
|
-
@type = :absolute
|
1055
|
-
@day_of_month = $1.to_i
|
1056
|
-
elsif $3
|
1057
|
-
@type = :last
|
1058
|
-
@day_of_week = parse_day_of_week($3)
|
1059
|
-
else
|
1060
|
-
@type = :comparison
|
1061
|
-
@day_of_week = parse_day_of_week($5)
|
1062
|
-
@operator = parse_operator($6)
|
1063
|
-
@day_of_month = $7.to_i
|
1064
|
-
end
|
1065
|
-
end
|
1066
|
-
|
1067
|
-
# Returns the absolute date for the given year and month.
|
1068
|
-
def to_absolute(year, month)
|
1069
|
-
case @type
|
1070
|
-
when :last
|
1071
|
-
last_day_in_month = (Date.new(year, month, 1) >> 1) - 1
|
1072
|
-
offset = last_day_in_month.wday - @day_of_week
|
1073
|
-
offset = offset + 7 if offset < 0
|
1074
|
-
last_day_in_month - offset
|
1075
|
-
when :comparison
|
1076
|
-
pivot = Date.new(year, month, @day_of_month)
|
1077
|
-
offset = @day_of_week - pivot.wday
|
1078
|
-
offset = -offset if @operator == :less_equal
|
1079
|
-
offset = offset + 7 if offset < 0
|
1080
|
-
offset = -offset if @operator == :less_equal
|
1081
|
-
pivot + offset
|
1082
|
-
else #absolute
|
1083
|
-
Date.new(year, month, @day_of_month)
|
1084
|
-
end
|
1085
|
-
end
|
1086
|
-
|
1087
|
-
private
|
1088
|
-
def parse_day_of_week(day_of_week)
|
1089
|
-
lower = day_of_week.downcase
|
1090
|
-
if lower =~ /^mon/
|
1091
|
-
1
|
1092
|
-
elsif lower =~ /^tue/
|
1093
|
-
2
|
1094
|
-
elsif lower =~ /^wed/
|
1095
|
-
3
|
1096
|
-
elsif lower =~ /^thu/
|
1097
|
-
4
|
1098
|
-
elsif lower =~ /^fri/
|
1099
|
-
5
|
1100
|
-
elsif lower =~ /^sat/
|
1101
|
-
6
|
1102
|
-
elsif lower =~ /^sun/
|
1103
|
-
0
|
1104
|
-
else
|
1105
|
-
raise "Invalid day of week: #{day_of_week}"
|
1106
|
-
end
|
1107
|
-
end
|
1108
|
-
|
1109
|
-
def parse_operator(operator)
|
1110
|
-
if operator == '>='
|
1111
|
-
:greater_equal
|
1112
|
-
elsif operator == '<='
|
1113
|
-
:less_equal
|
1114
|
-
else
|
1115
|
-
raise "Invalid operator: #{operator}"
|
1116
|
-
end
|
1117
|
-
end
|
1118
|
-
end
|
1119
|
-
|
1120
|
-
# A tz data Zone until reference.
|
1121
|
-
#
|
1122
|
-
# @private
|
1123
|
-
class TZDataUntil #:nodoc:
|
1124
|
-
attr_reader :year
|
1125
|
-
attr_reader :month
|
1126
|
-
attr_reader :day
|
1127
|
-
attr_reader :time
|
1128
|
-
|
1129
|
-
def initialize(spec)
|
1130
|
-
parts = spec.split(/\s+/)
|
1131
|
-
raise "Invalid until: #{spec}" if parts.length < 1
|
1132
|
-
|
1133
|
-
@year = parts[0].to_i
|
1134
|
-
@month = parts.length > 1 ? TZDataParser.parse_month(parts[1]) : 1
|
1135
|
-
@day = TZDataDayOfMonth.new(parts.length > 2 ? parts[2] : '1')
|
1136
|
-
@time = TZDataTime.new(parts.length > 3 ? parts[3] : '00:00')
|
1137
|
-
end
|
1138
|
-
|
1139
|
-
# Converts the reference to a UTC DateTime.
|
1140
|
-
def to_utc(utc_offset, std_offset)
|
1141
|
-
absolute = @day.to_absolute(@year, @month)
|
1142
|
-
@time.to_utc(utc_offset, std_offset, absolute.year, absolute.month, absolute.day)
|
1143
|
-
end
|
1144
|
-
end
|
1145
|
-
|
1146
|
-
# A tz data Zone format string. Either alternate standard/daylight-savings,
|
1147
|
-
# substitution (%s) format or a fixed string.
|
1148
|
-
#
|
1149
|
-
# @private
|
1150
|
-
class TZDataFormat #:nodoc:
|
1151
|
-
def initialize(spec)
|
1152
|
-
if spec =~ /\A([^\/]*)\/(.*)\z/
|
1153
|
-
@type = :alternate
|
1154
|
-
@standard_abbrev = $1
|
1155
|
-
@daylight_abbrev = $2
|
1156
|
-
elsif spec =~ /%[sz]/
|
1157
|
-
@type = :subst
|
1158
|
-
@abbrev = spec
|
1159
|
-
else
|
1160
|
-
@type = :fixed
|
1161
|
-
@abbrev = spec
|
1162
|
-
end
|
1163
|
-
end
|
1164
|
-
|
1165
|
-
# Expands given the base offset to UTC, the current daylight savings
|
1166
|
-
# offset and rule string.
|
1167
|
-
def expand(utc_offset, std_offset, rule_string)
|
1168
|
-
if @type == :alternate
|
1169
|
-
if std_offset == 0
|
1170
|
-
@standard_abbrev
|
1171
|
-
else
|
1172
|
-
@daylight_abbrev
|
1173
|
-
end
|
1174
|
-
elsif @type == :subst
|
1175
|
-
@abbrev.gsub(/%([sz])/) do
|
1176
|
-
$1 == 's' ? rule_string : format_offset(utc_offset + std_offset)
|
1177
|
-
end
|
1178
|
-
else
|
1179
|
-
@abbrev
|
1180
|
-
end
|
1181
|
-
end
|
1182
|
-
|
1183
|
-
# True if the format requires substitutions (%s or %z).
|
1184
|
-
def subst?
|
1185
|
-
@type == :subst
|
1186
|
-
end
|
1187
|
-
|
1188
|
-
# Is a fixed format string.
|
1189
|
-
def fixed?
|
1190
|
-
@type == :fixed
|
1191
|
-
end
|
1192
|
-
|
1193
|
-
private
|
1194
|
-
|
1195
|
-
# Formats an offset according to the rules for %z.
|
1196
|
-
def format_offset(offset)
|
1197
|
-
if offset < 0
|
1198
|
-
offset = -offset
|
1199
|
-
sign = '-'
|
1200
|
-
else
|
1201
|
-
sign = '+'
|
1202
|
-
end
|
1203
|
-
|
1204
|
-
offset, seconds = offset.divmod(60)
|
1205
|
-
offset, minutes = offset.divmod(60)
|
1206
|
-
|
1207
|
-
if offset > 99
|
1208
|
-
# unsupported
|
1209
|
-
'%z'
|
1210
|
-
else
|
1211
|
-
result = "#{sign}#{offset.to_s.rjust(2, '0')}"
|
1212
|
-
|
1213
|
-
if minutes != 0 || seconds != 0
|
1214
|
-
result << minutes.to_s.rjust(2, '0')
|
1215
|
-
|
1216
|
-
if seconds != 0
|
1217
|
-
result << seconds.to_s.rjust(2, '0')
|
1218
|
-
end
|
1219
|
-
end
|
1220
|
-
|
1221
|
-
result
|
1222
|
-
end
|
1223
|
-
end
|
1224
|
-
end
|
1225
|
-
|
1226
|
-
# A location (latitude + longitude)
|
1227
|
-
#
|
1228
|
-
# @private
|
1229
|
-
class TZDataLocation #:nodoc:
|
1230
|
-
attr_reader :latitude
|
1231
|
-
attr_reader :longitude
|
1232
|
-
|
1233
|
-
# Constructs a new TZDataLocation from a string in ISO 6709
|
1234
|
-
# sign-degrees-minutes-seconds format, either +-DDMM+-DDDMM
|
1235
|
-
# or +-DDMMSS+-DDDMMSS, first latitude (+ is north),
|
1236
|
-
# then longitude (+ is east).
|
1237
|
-
def initialize(coordinates)
|
1238
|
-
if coordinates !~ /^([+\-])([0-9]{2})([0-9]{2})([0-9]{2})?([+\-])([0-9]{3})([0-9]{2})([0-9]{2})?$/
|
1239
|
-
raise "Invalid coordinates: #{coordinates}"
|
1240
|
-
end
|
1241
|
-
|
1242
|
-
@latitude = Rational($2.to_i) + Rational($3.to_i, 60)
|
1243
|
-
@latitude += Rational($4.to_i, 3600) unless $4.nil?
|
1244
|
-
@latitude = -@latitude if $1 == '-'
|
1245
|
-
|
1246
|
-
@longitude = Rational($6.to_i) + Rational($7.to_i, 60)
|
1247
|
-
@longitude += Rational($8.to_i, 3600) unless $8.nil?
|
1248
|
-
@longitude = -@longitude if $5 == '-'
|
1249
|
-
end
|
1250
|
-
end
|
1251
|
-
|
1252
|
-
# @private
|
1253
|
-
TZDataCountryTimezone = Struct.new(:timezone, :description, :location)
|
1254
|
-
|
1255
|
-
# An ISO 3166 country.
|
1256
|
-
#
|
1257
|
-
# @private
|
1258
|
-
class TZDataCountry #:nodoc:
|
1259
|
-
attr_reader :code
|
1260
|
-
attr_reader :name
|
1261
|
-
attr_reader :zones
|
1262
|
-
|
1263
|
-
def initialize(code, name)
|
1264
|
-
@code = code
|
1265
|
-
@name = name
|
1266
|
-
@zones = []
|
1267
|
-
end
|
1268
|
-
|
1269
|
-
# Adds a TZDataCountryTimezone
|
1270
|
-
def add_zone(zone)
|
1271
|
-
@zones << zone
|
1272
|
-
end
|
1273
|
-
|
1274
|
-
def write_index_record(file)
|
1275
|
-
s = " country #{TZDataParser.quote_str(@code)}, #{TZDataParser.quote_str(@name)}"
|
1276
|
-
s << ' do |c|' if @zones.length > 0
|
1277
|
-
|
1278
|
-
file.puts s
|
1279
|
-
|
1280
|
-
@zones.each do |zone|
|
1281
|
-
file.puts " c.timezone #{TZDataParser.quote_str(zone.timezone.name)}, #{zone.location.latitude.numerator}, #{zone.location.latitude.denominator}, #{zone.location.longitude.numerator}, #{zone.location.longitude.denominator}#{zone.description.nil? ? '' : ', ' + TZDataParser.quote_str(zone.description)}"
|
1282
|
-
end
|
1283
|
-
|
1284
|
-
file.puts ' end' if @zones.length > 0
|
1285
|
-
end
|
1286
|
-
end
|
1287
|
-
end
|