File Coverage

blib/lib/Time/OlsonTZ/Data.pm
Criterion Covered Total %
statement 48 48 100.0
branch 11 14 78.5
condition 6 11 54.5
subroutine 14 14 100.0
pod 6 6 100.0
total 85 93 91.4


line stmt bran cond sub pod time code
1             =head1 NAME
2              
3             Time::OlsonTZ::Data - Olson timezone data
4              
5             =head1 SYNOPSIS
6              
7             use Time::OlsonTZ::Data qw(olson_version);
8              
9             $version = olson_version;
10              
11             use Time::OlsonTZ::Data qw(
12             olson_canonical_names olson_link_names olson_all_names
13             olson_links olson_country_selection);
14              
15             $names = olson_canonical_names;
16             $names = olson_link_names;
17             $names = olson_all_names;
18             $links = olson_links;
19             $countries = olson_country_selection;
20              
21             use Time::OlsonTZ::Data qw(olson_tzfile);
22              
23             $filename = olson_tzfile("America/New_York");
24              
25             =head1 DESCRIPTION
26              
27             This module encapsulates the Olson timezone database, providing binary
28             tzfiles and ancillary data. Each version of this module encapsulates
29             a particular version of the timezone database. It is intended to be
30             regularly updated, as the timezone database changes.
31              
32             =cut
33              
34             package Time::OlsonTZ::Data;
35              
36 9     9   1289782 { use 5.006; }
  9         73  
37 9     9   52 use warnings;
  9         35  
  9         665  
38 9     9   59 use strict;
  9         17  
  9         459  
39              
40             our $VERSION = "0.202601";
41              
42 9     9   4213 use parent "Exporter";
  9         2640  
  9         64  
43             our @EXPORT_OK = qw(
44             olson_version olson_code_version olson_data_version
45             olson_canonical_names olson_link_names olson_all_names
46             olson_links
47             olson_country_selection
48             olson_tzfile
49             );
50              
51             my($datavol, $datadir);
52             sub _data_file($) {
53 1197     1197   1842 my($upath) = @_;
54 1197 100       2039 unless(defined $datadir) {
55 4         72 require File::Spec;
56             ($datavol, $datadir, undef) =
57 4         177 File::Spec->splitpath($INC{"Time/OlsonTZ/Data.pm"});
58             }
59 1197         2463 my @nameparts = split(/\//, $upath);
60 1197         1876 my $filename = pop(@nameparts);
61 1197         10492 return File::Spec->catpath($datavol,
62             File::Spec->catdir($datadir, "Data", @nameparts), $filename);
63             }
64              
65             =head1 FUNCTIONS
66              
67             =head2 Basic information
68              
69             =over
70              
71             =item olson_version
72              
73             Returns the version number of the database that this module encapsulates.
74             Version numbers for the Olson database currently consist of a year number
75             and a lowercase letter, such as "C<2010k>"; they are not guaranteed to
76             retain this format in the future.
77              
78             =cut
79              
80 9     9   2533 use constant olson_version => "2026a";
  9         17  
  9         1237  
81              
82             =item olson_code_version
83              
84             Returns the version number of the code part of the database that this
85             module encapsulates. This is now always the same as the value returned
86             by L. Until late 2012 the database was distributed in
87             two parts, each with their own version number, so this was a distinct
88             piece of information.
89              
90             =cut
91              
92 9     9   66 use constant olson_code_version => "2026a";
  9         17  
  9         609  
93              
94             =item olson_data_version
95              
96             Returns the version number of the data part of the database that this
97             module encapsulates. This is now always the same as the value returned
98             by L. Until late 2012 the database was distributed in
99             two parts, each with their own version number, so this was a distinct
100             piece of information.
101              
102             =cut
103              
104 9     9   79 use constant olson_data_version => "2026a";
  9         18  
  9         12019  
105              
106             =back
107              
108             =head2 Zone metadata
109              
110             =over
111              
112             =item olson_canonical_names
113              
114             Returns the set of timezone names that this version of the database
115             defines as canonical. These are the timezone names that are directly
116             associated with a set of observance data. The return value is a reference
117             to a hash, in which the keys are the canonical timezone names and the
118             values are all C.
119              
120             =cut
121              
122             my $cn = q(+{ map { ($_ => undef) } qw(
123             Africa/Abidjan Africa/Algiers Africa/Bissau Africa/Cairo
124             Africa/Casablanca Africa/Ceuta Africa/El_Aaiun Africa/Johannesburg
125             Africa/Juba Africa/Khartoum Africa/Lagos Africa/Maputo Africa/Monrovia
126             Africa/Nairobi Africa/Ndjamena Africa/Sao_Tome Africa/Tripoli
127             Africa/Tunis Africa/Windhoek America/Adak America/Anchorage
128             America/Araguaina America/Argentina/Buenos_Aires
129             America/Argentina/Catamarca America/Argentina/Cordoba
130             America/Argentina/Jujuy America/Argentina/La_Rioja
131             America/Argentina/Mendoza America/Argentina/Rio_Gallegos
132             America/Argentina/Salta America/Argentina/San_Juan
133             America/Argentina/San_Luis America/Argentina/Tucuman
134             America/Argentina/Ushuaia America/Asuncion America/Bahia
135             America/Bahia_Banderas America/Barbados America/Belem America/Belize
136             America/Boa_Vista America/Bogota America/Boise America/Cambridge_Bay
137             America/Campo_Grande America/Cancun America/Caracas America/Cayenne
138             America/Chicago America/Chihuahua America/Ciudad_Juarez
139             America/Costa_Rica America/Coyhaique America/Cuiaba America/Danmarkshavn
140             America/Dawson America/Dawson_Creek America/Denver America/Detroit
141             America/Edmonton America/Eirunepe America/El_Salvador
142             America/Fort_Nelson America/Fortaleza America/Glace_Bay
143             America/Goose_Bay America/Grand_Turk America/Guatemala America/Guayaquil
144             America/Guyana America/Halifax America/Havana America/Hermosillo
145             America/Indiana/Indianapolis America/Indiana/Knox
146             America/Indiana/Marengo America/Indiana/Petersburg
147             America/Indiana/Tell_City America/Indiana/Vevay
148             America/Indiana/Vincennes America/Indiana/Winamac America/Inuvik
149             America/Iqaluit America/Jamaica America/Juneau
150             America/Kentucky/Louisville America/Kentucky/Monticello America/La_Paz
151             America/Lima America/Los_Angeles America/Maceio America/Managua
152             America/Manaus America/Martinique America/Matamoros America/Mazatlan
153             America/Menominee America/Merida America/Metlakatla America/Mexico_City
154             America/Miquelon America/Moncton America/Monterrey America/Montevideo
155             America/New_York America/Nome America/Noronha
156             America/North_Dakota/Beulah America/North_Dakota/Center
157             America/North_Dakota/New_Salem America/Nuuk America/Ojinaga
158             America/Panama America/Paramaribo America/Phoenix America/Port-au-Prince
159             America/Porto_Velho America/Puerto_Rico America/Punta_Arenas
160             America/Rankin_Inlet America/Recife America/Regina America/Resolute
161             America/Rio_Branco America/Santarem America/Santiago
162             America/Santo_Domingo America/Sao_Paulo America/Scoresbysund
163             America/Sitka America/St_Johns America/Swift_Current America/Tegucigalpa
164             America/Thule America/Tijuana America/Toronto America/Vancouver
165             America/Whitehorse America/Winnipeg America/Yakutat Antarctica/Casey
166             Antarctica/Davis Antarctica/Macquarie Antarctica/Mawson
167             Antarctica/Palmer Antarctica/Rothera Antarctica/Troll Antarctica/Vostok
168             Asia/Almaty Asia/Amman Asia/Anadyr Asia/Aqtau Asia/Aqtobe Asia/Ashgabat
169             Asia/Atyrau Asia/Baghdad Asia/Baku Asia/Bangkok Asia/Barnaul Asia/Beirut
170             Asia/Bishkek Asia/Chita Asia/Colombo Asia/Damascus Asia/Dhaka Asia/Dili
171             Asia/Dubai Asia/Dushanbe Asia/Famagusta Asia/Gaza Asia/Hebron
172             Asia/Ho_Chi_Minh Asia/Hong_Kong Asia/Hovd Asia/Irkutsk Asia/Jakarta
173             Asia/Jayapura Asia/Jerusalem Asia/Kabul Asia/Kamchatka Asia/Karachi
174             Asia/Kathmandu Asia/Khandyga Asia/Kolkata Asia/Krasnoyarsk Asia/Kuching
175             Asia/Macau Asia/Magadan Asia/Makassar Asia/Manila Asia/Nicosia
176             Asia/Novokuznetsk Asia/Novosibirsk Asia/Omsk Asia/Oral Asia/Pontianak
177             Asia/Pyongyang Asia/Qatar Asia/Qostanay Asia/Qyzylorda Asia/Riyadh
178             Asia/Sakhalin Asia/Samarkand Asia/Seoul Asia/Shanghai Asia/Singapore
179             Asia/Srednekolymsk Asia/Taipei Asia/Tashkent Asia/Tbilisi Asia/Tehran
180             Asia/Thimphu Asia/Tokyo Asia/Tomsk Asia/Ulaanbaatar Asia/Urumqi
181             Asia/Ust-Nera Asia/Vladivostok Asia/Yakutsk Asia/Yangon
182             Asia/Yekaterinburg Asia/Yerevan Atlantic/Azores Atlantic/Bermuda
183             Atlantic/Canary Atlantic/Cape_Verde Atlantic/Faroe Atlantic/Madeira
184             Atlantic/South_Georgia Atlantic/Stanley Australia/Adelaide
185             Australia/Brisbane Australia/Broken_Hill Australia/Darwin
186             Australia/Eucla Australia/Hobart Australia/Lindeman Australia/Lord_Howe
187             Australia/Melbourne Australia/Perth Australia/Sydney Etc/GMT Etc/GMT+1
188             Etc/GMT+10 Etc/GMT+11 Etc/GMT+12 Etc/GMT+2 Etc/GMT+3 Etc/GMT+4 Etc/GMT+5
189             Etc/GMT+6 Etc/GMT+7 Etc/GMT+8 Etc/GMT+9 Etc/GMT-1 Etc/GMT-10 Etc/GMT-11
190             Etc/GMT-12 Etc/GMT-13 Etc/GMT-14 Etc/GMT-2 Etc/GMT-3 Etc/GMT-4 Etc/GMT-5
191             Etc/GMT-6 Etc/GMT-7 Etc/GMT-8 Etc/GMT-9 Etc/UTC Europe/Andorra
192             Europe/Astrakhan Europe/Athens Europe/Belgrade Europe/Berlin
193             Europe/Brussels Europe/Bucharest Europe/Budapest Europe/Chisinau
194             Europe/Dublin Europe/Gibraltar Europe/Helsinki Europe/Istanbul
195             Europe/Kaliningrad Europe/Kirov Europe/Kyiv Europe/Lisbon Europe/London
196             Europe/Madrid Europe/Malta Europe/Minsk Europe/Moscow Europe/Paris
197             Europe/Prague Europe/Riga Europe/Rome Europe/Samara Europe/Saratov
198             Europe/Simferopol Europe/Sofia Europe/Tallinn Europe/Tirane
199             Europe/Ulyanovsk Europe/Vienna Europe/Vilnius Europe/Volgograd
200             Europe/Warsaw Europe/Zurich Factory Indian/Chagos Indian/Maldives
201             Indian/Mauritius Pacific/Apia Pacific/Auckland Pacific/Bougainville
202             Pacific/Chatham Pacific/Easter Pacific/Efate Pacific/Fakaofo
203             Pacific/Fiji Pacific/Galapagos Pacific/Gambier Pacific/Guadalcanal
204             Pacific/Guam Pacific/Honolulu Pacific/Kanton Pacific/Kiritimati
205             Pacific/Kosrae Pacific/Kwajalein Pacific/Marquesas Pacific/Nauru
206             Pacific/Niue Pacific/Norfolk Pacific/Noumea Pacific/Pago_Pago
207             Pacific/Palau Pacific/Pitcairn Pacific/Port_Moresby Pacific/Rarotonga
208             Pacific/Tahiti Pacific/Tarawa Pacific/Tongatapu
209             ) });
210             sub olson_canonical_names() {
211 1205 100 50 1205 1 852675 $cn = eval($cn) || die $@ if ref($cn) eq "";
212 1205         3113 return $cn;
213             }
214              
215             =item olson_link_names
216              
217             Returns the set of timezone names that this version of the database
218             defines as links. These are the timezone names that are aliases for
219             other names. The return value is a reference to a hash, in which the
220             keys are the link timezone names and the values are all C.
221              
222             =cut
223              
224             sub olson_links();
225              
226             my $ln;
227             sub olson_link_names() {
228 4   100 4 1 201 return $ln ||= { map { ($_ => undef) } keys %{olson_links()} };
  771         1884  
  3         13  
229             }
230              
231             =item olson_all_names
232              
233             Returns the set of timezone names that this version of the
234             database defines. These are the L and the
235             L. The return value is a reference to a hash, in
236             which the keys are the timezone names and the values are all C.
237              
238             =cut
239              
240             my $an;
241             sub olson_all_names() {
242             return $an ||= {
243 2         8 %{olson_canonical_names()},
244 2   50 2 1 253836 %{olson_link_names()},
  2         10  
245             };
246             }
247              
248             =item olson_links
249              
250             Returns details of the timezone name links in this version of the
251             database. Each link defines one timezone name as an alias for some
252             other timezone name. The return value is a reference to a hash, in
253             which the keys are the aliases and each value is the canonical name of
254             the timezone to which that alias refers. All such canonical names can
255             be found in the L hash.
256              
257             =cut
258              
259             my $li = q(+{
260             "Africa/Accra" => "Africa/Abidjan",
261             "Africa/Addis_Ababa" => "Africa/Nairobi",
262             "Africa/Asmara" => "Africa/Nairobi",
263             "Africa/Asmera" => "Africa/Nairobi",
264             "Africa/Bamako" => "Africa/Abidjan",
265             "Africa/Bangui" => "Africa/Lagos",
266             "Africa/Banjul" => "Africa/Abidjan",
267             "Africa/Blantyre" => "Africa/Maputo",
268             "Africa/Brazzaville" => "Africa/Lagos",
269             "Africa/Bujumbura" => "Africa/Maputo",
270             "Africa/Conakry" => "Africa/Abidjan",
271             "Africa/Dakar" => "Africa/Abidjan",
272             "Africa/Dar_es_Salaam" => "Africa/Nairobi",
273             "Africa/Djibouti" => "Africa/Nairobi",
274             "Africa/Douala" => "Africa/Lagos",
275             "Africa/Freetown" => "Africa/Abidjan",
276             "Africa/Gaborone" => "Africa/Maputo",
277             "Africa/Harare" => "Africa/Maputo",
278             "Africa/Kampala" => "Africa/Nairobi",
279             "Africa/Kigali" => "Africa/Maputo",
280             "Africa/Kinshasa" => "Africa/Lagos",
281             "Africa/Libreville" => "Africa/Lagos",
282             "Africa/Lome" => "Africa/Abidjan",
283             "Africa/Luanda" => "Africa/Lagos",
284             "Africa/Lubumbashi" => "Africa/Maputo",
285             "Africa/Lusaka" => "Africa/Maputo",
286             "Africa/Malabo" => "Africa/Lagos",
287             "Africa/Maseru" => "Africa/Johannesburg",
288             "Africa/Mbabane" => "Africa/Johannesburg",
289             "Africa/Mogadishu" => "Africa/Nairobi",
290             "Africa/Niamey" => "Africa/Lagos",
291             "Africa/Nouakchott" => "Africa/Abidjan",
292             "Africa/Ouagadougou" => "Africa/Abidjan",
293             "Africa/Porto-Novo" => "Africa/Lagos",
294             "Africa/Timbuktu" => "Africa/Abidjan",
295             "America/Anguilla" => "America/Puerto_Rico",
296             "America/Antigua" => "America/Puerto_Rico",
297             "America/Argentina/ComodRivadavia" => "America/Argentina/Catamarca",
298             "America/Aruba" => "America/Puerto_Rico",
299             "America/Atikokan" => "America/Panama",
300             "America/Atka" => "America/Adak",
301             "America/Blanc-Sablon" => "America/Puerto_Rico",
302             "America/Buenos_Aires" => "America/Argentina/Buenos_Aires",
303             "America/Catamarca" => "America/Argentina/Catamarca",
304             "America/Cayman" => "America/Panama",
305             "America/Coral_Harbour" => "America/Panama",
306             "America/Cordoba" => "America/Argentina/Cordoba",
307             "America/Creston" => "America/Phoenix",
308             "America/Curacao" => "America/Puerto_Rico",
309             "America/Dominica" => "America/Puerto_Rico",
310             "America/Ensenada" => "America/Tijuana",
311             "America/Fort_Wayne" => "America/Indiana/Indianapolis",
312             "America/Godthab" => "America/Nuuk",
313             "America/Grenada" => "America/Puerto_Rico",
314             "America/Guadeloupe" => "America/Puerto_Rico",
315             "America/Indianapolis" => "America/Indiana/Indianapolis",
316             "America/Jujuy" => "America/Argentina/Jujuy",
317             "America/Knox_IN" => "America/Indiana/Knox",
318             "America/Kralendijk" => "America/Puerto_Rico",
319             "America/Louisville" => "America/Kentucky/Louisville",
320             "America/Lower_Princes" => "America/Puerto_Rico",
321             "America/Marigot" => "America/Puerto_Rico",
322             "America/Mendoza" => "America/Argentina/Mendoza",
323             "America/Montreal" => "America/Toronto",
324             "America/Montserrat" => "America/Puerto_Rico",
325             "America/Nassau" => "America/Toronto",
326             "America/Nipigon" => "America/Toronto",
327             "America/Pangnirtung" => "America/Iqaluit",
328             "America/Port_of_Spain" => "America/Puerto_Rico",
329             "America/Porto_Acre" => "America/Rio_Branco",
330             "America/Rainy_River" => "America/Winnipeg",
331             "America/Rosario" => "America/Argentina/Cordoba",
332             "America/Santa_Isabel" => "America/Tijuana",
333             "America/Shiprock" => "America/Denver",
334             "America/St_Barthelemy" => "America/Puerto_Rico",
335             "America/St_Kitts" => "America/Puerto_Rico",
336             "America/St_Lucia" => "America/Puerto_Rico",
337             "America/St_Thomas" => "America/Puerto_Rico",
338             "America/St_Vincent" => "America/Puerto_Rico",
339             "America/Thunder_Bay" => "America/Toronto",
340             "America/Tortola" => "America/Puerto_Rico",
341             "America/Virgin" => "America/Puerto_Rico",
342             "America/Yellowknife" => "America/Edmonton",
343             "Antarctica/DumontDUrville" => "Pacific/Port_Moresby",
344             "Antarctica/McMurdo" => "Pacific/Auckland",
345             "Antarctica/South_Pole" => "Pacific/Auckland",
346             "Antarctica/Syowa" => "Asia/Riyadh",
347             "Arctic/Longyearbyen" => "Europe/Berlin",
348             "Asia/Aden" => "Asia/Riyadh",
349             "Asia/Ashkhabad" => "Asia/Ashgabat",
350             "Asia/Bahrain" => "Asia/Qatar",
351             "Asia/Brunei" => "Asia/Kuching",
352             "Asia/Calcutta" => "Asia/Kolkata",
353             "Asia/Choibalsan" => "Asia/Ulaanbaatar",
354             "Asia/Chongqing" => "Asia/Shanghai",
355             "Asia/Chungking" => "Asia/Shanghai",
356             "Asia/Dacca" => "Asia/Dhaka",
357             "Asia/Harbin" => "Asia/Shanghai",
358             "Asia/Istanbul" => "Europe/Istanbul",
359             "Asia/Kashgar" => "Asia/Urumqi",
360             "Asia/Katmandu" => "Asia/Kathmandu",
361             "Asia/Kuala_Lumpur" => "Asia/Singapore",
362             "Asia/Kuwait" => "Asia/Riyadh",
363             "Asia/Macao" => "Asia/Macau",
364             "Asia/Muscat" => "Asia/Dubai",
365             "Asia/Phnom_Penh" => "Asia/Bangkok",
366             "Asia/Rangoon" => "Asia/Yangon",
367             "Asia/Saigon" => "Asia/Ho_Chi_Minh",
368             "Asia/Tel_Aviv" => "Asia/Jerusalem",
369             "Asia/Thimbu" => "Asia/Thimphu",
370             "Asia/Ujung_Pandang" => "Asia/Makassar",
371             "Asia/Ulan_Bator" => "Asia/Ulaanbaatar",
372             "Asia/Vientiane" => "Asia/Bangkok",
373             "Atlantic/Faeroe" => "Atlantic/Faroe",
374             "Atlantic/Jan_Mayen" => "Europe/Berlin",
375             "Atlantic/Reykjavik" => "Africa/Abidjan",
376             "Atlantic/St_Helena" => "Africa/Abidjan",
377             "Australia/ACT" => "Australia/Sydney",
378             "Australia/Canberra" => "Australia/Sydney",
379             "Australia/Currie" => "Australia/Hobart",
380             "Australia/LHI" => "Australia/Lord_Howe",
381             "Australia/NSW" => "Australia/Sydney",
382             "Australia/North" => "Australia/Darwin",
383             "Australia/Queensland" => "Australia/Brisbane",
384             "Australia/South" => "Australia/Adelaide",
385             "Australia/Tasmania" => "Australia/Hobart",
386             "Australia/Victoria" => "Australia/Melbourne",
387             "Australia/West" => "Australia/Perth",
388             "Australia/Yancowinna" => "Australia/Broken_Hill",
389             "Brazil/Acre" => "America/Rio_Branco",
390             "Brazil/DeNoronha" => "America/Noronha",
391             "Brazil/East" => "America/Sao_Paulo",
392             "Brazil/West" => "America/Manaus",
393             CET => "Europe/Brussels",
394             CST6CDT => "America/Chicago",
395             "Canada/Atlantic" => "America/Halifax",
396             "Canada/Central" => "America/Winnipeg",
397             "Canada/Eastern" => "America/Toronto",
398             "Canada/Mountain" => "America/Edmonton",
399             "Canada/Newfoundland" => "America/St_Johns",
400             "Canada/Pacific" => "America/Vancouver",
401             "Canada/Saskatchewan" => "America/Regina",
402             "Canada/Yukon" => "America/Whitehorse",
403             "Chile/Continental" => "America/Santiago",
404             "Chile/EasterIsland" => "Pacific/Easter",
405             Cuba => "America/Havana",
406             EET => "Europe/Athens",
407             EST => "America/Panama",
408             EST5EDT => "America/New_York",
409             Egypt => "Africa/Cairo",
410             Eire => "Europe/Dublin",
411             "Etc/GMT+0" => "Etc/GMT",
412             "Etc/GMT-0" => "Etc/GMT",
413             "Etc/GMT0" => "Etc/GMT",
414             "Etc/Greenwich" => "Etc/GMT",
415             "Etc/UCT" => "Etc/UTC",
416             "Etc/Universal" => "Etc/UTC",
417             "Etc/Zulu" => "Etc/UTC",
418             "Europe/Amsterdam" => "Europe/Brussels",
419             "Europe/Belfast" => "Europe/London",
420             "Europe/Bratislava" => "Europe/Prague",
421             "Europe/Busingen" => "Europe/Zurich",
422             "Europe/Copenhagen" => "Europe/Berlin",
423             "Europe/Guernsey" => "Europe/London",
424             "Europe/Isle_of_Man" => "Europe/London",
425             "Europe/Jersey" => "Europe/London",
426             "Europe/Kiev" => "Europe/Kyiv",
427             "Europe/Ljubljana" => "Europe/Belgrade",
428             "Europe/Luxembourg" => "Europe/Brussels",
429             "Europe/Mariehamn" => "Europe/Helsinki",
430             "Europe/Monaco" => "Europe/Paris",
431             "Europe/Nicosia" => "Asia/Nicosia",
432             "Europe/Oslo" => "Europe/Berlin",
433             "Europe/Podgorica" => "Europe/Belgrade",
434             "Europe/San_Marino" => "Europe/Rome",
435             "Europe/Sarajevo" => "Europe/Belgrade",
436             "Europe/Skopje" => "Europe/Belgrade",
437             "Europe/Stockholm" => "Europe/Berlin",
438             "Europe/Tiraspol" => "Europe/Chisinau",
439             "Europe/Uzhgorod" => "Europe/Kyiv",
440             "Europe/Vaduz" => "Europe/Zurich",
441             "Europe/Vatican" => "Europe/Rome",
442             "Europe/Zagreb" => "Europe/Belgrade",
443             "Europe/Zaporozhye" => "Europe/Kyiv",
444             GB => "Europe/London",
445             "GB-Eire" => "Europe/London",
446             GMT => "Etc/GMT",
447             "GMT+0" => "Etc/GMT",
448             "GMT-0" => "Etc/GMT",
449             GMT0 => "Etc/GMT",
450             Greenwich => "Etc/GMT",
451             HST => "Pacific/Honolulu",
452             Hongkong => "Asia/Hong_Kong",
453             Iceland => "Africa/Abidjan",
454             "Indian/Antananarivo" => "Africa/Nairobi",
455             "Indian/Christmas" => "Asia/Bangkok",
456             "Indian/Cocos" => "Asia/Yangon",
457             "Indian/Comoro" => "Africa/Nairobi",
458             "Indian/Kerguelen" => "Indian/Maldives",
459             "Indian/Mahe" => "Asia/Dubai",
460             "Indian/Mayotte" => "Africa/Nairobi",
461             "Indian/Reunion" => "Asia/Dubai",
462             Iran => "Asia/Tehran",
463             Israel => "Asia/Jerusalem",
464             Jamaica => "America/Jamaica",
465             Japan => "Asia/Tokyo",
466             Kwajalein => "Pacific/Kwajalein",
467             Libya => "Africa/Tripoli",
468             MET => "Europe/Brussels",
469             MST => "America/Phoenix",
470             MST7MDT => "America/Denver",
471             "Mexico/BajaNorte" => "America/Tijuana",
472             "Mexico/BajaSur" => "America/Mazatlan",
473             "Mexico/General" => "America/Mexico_City",
474             NZ => "Pacific/Auckland",
475             "NZ-CHAT" => "Pacific/Chatham",
476             Navajo => "America/Denver",
477             PRC => "Asia/Shanghai",
478             PST8PDT => "America/Los_Angeles",
479             "Pacific/Chuuk" => "Pacific/Port_Moresby",
480             "Pacific/Enderbury" => "Pacific/Kanton",
481             "Pacific/Funafuti" => "Pacific/Tarawa",
482             "Pacific/Johnston" => "Pacific/Honolulu",
483             "Pacific/Majuro" => "Pacific/Tarawa",
484             "Pacific/Midway" => "Pacific/Pago_Pago",
485             "Pacific/Pohnpei" => "Pacific/Guadalcanal",
486             "Pacific/Ponape" => "Pacific/Guadalcanal",
487             "Pacific/Saipan" => "Pacific/Guam",
488             "Pacific/Samoa" => "Pacific/Pago_Pago",
489             "Pacific/Truk" => "Pacific/Port_Moresby",
490             "Pacific/Wake" => "Pacific/Tarawa",
491             "Pacific/Wallis" => "Pacific/Tarawa",
492             "Pacific/Yap" => "Pacific/Port_Moresby",
493             Poland => "Europe/Warsaw",
494             Portugal => "Europe/Lisbon",
495             ROC => "Asia/Taipei",
496             ROK => "Asia/Seoul",
497             Singapore => "Asia/Singapore",
498             Turkey => "Europe/Istanbul",
499             UCT => "Etc/UTC",
500             "US/Alaska" => "America/Anchorage",
501             "US/Aleutian" => "America/Adak",
502             "US/Arizona" => "America/Phoenix",
503             "US/Central" => "America/Chicago",
504             "US/East-Indiana" => "America/Indiana/Indianapolis",
505             "US/Eastern" => "America/New_York",
506             "US/Hawaii" => "Pacific/Honolulu",
507             "US/Indiana-Starke" => "America/Indiana/Knox",
508             "US/Michigan" => "America/Detroit",
509             "US/Mountain" => "America/Denver",
510             "US/Pacific" => "America/Los_Angeles",
511             "US/Samoa" => "Pacific/Pago_Pago",
512             UTC => "Etc/UTC",
513             Universal => "Etc/UTC",
514             "W-SU" => "Europe/Moscow",
515             WET => "Europe/Lisbon",
516             Zulu => "Etc/UTC",
517             });
518             sub olson_links() {
519 1461 100 50 1461 1 195972 $li = eval($li) || die $@ if ref($li) eq "";
520 1461         3498 return $li;
521             }
522              
523             =item olson_country_selection
524              
525             Returns information about how timezones relate to countries, intended
526             to aid humans in selecting a geographical timezone. This information
527             is derived from the C and C files in the database
528             source.
529              
530             The return value is a reference to a hash, keyed by (ISO 3166 alpha-2
531             uppercase) country code. The value for each country is a hash containing
532             these values:
533              
534             =over
535              
536             =item B
537              
538             The ISO 3166 alpha-2 uppercase country code.
539              
540             =item B
541              
542             An English name for the country, possibly in a modified form, optimised
543             to help humans find the right entry in alphabetical lists. This is
544             not necessarily identical to the country's standard short or long name.
545             (For other forms of the name, consult a database of countries, keying
546             by the country code.)
547              
548             =item B
549              
550             Information about the regions of the country that use distinct
551             timezones. This is a hash, keyed by English description of the region.
552             The description is empty if there is only one region. The value for
553             each region is a hash containing these values:
554              
555             =over
556              
557             =item B
558              
559             Brief English description of the region, used to distinguish between
560             the regions of a single country. Empty string if the country has only
561             one region for timezone purposes. (This is the same string used as the
562             key in the B hash.)
563              
564             =item B
565              
566             Name of the Olson timezone used in this region. The named timezone is
567             guaranteed to exist in the database, but not necessarily as a canonical
568             name (it may be a link). Typically, where there are aliases or identical
569             canonical zones, a name is chosen that refers to a location in the
570             country of interest.
571              
572             =item B
573              
574             Geographical coordinates of some point within the location referred to in
575             the timezone name. This is a latitude and longitude, in ISO 6709 format.
576              
577             =back
578              
579             =back
580              
581             This data structure is intended to help a human select the appropriate
582             timezone based on political geography, specifically working from a
583             selection of country. It is of essentially no use for any other purpose.
584             It is not strictly guaranteed that every geographical timezone in the
585             database is listed somewhere in this structure, so it is of limited use
586             in providing information about an already-selected timezone. It does
587             not include non-geographic timezones at all. It also does not claim
588             to be a comprehensive list of countries, and does not make any claims
589             regarding the political status of any entity listed: the "country"
590             classification is loose, and used only for identification purposes.
591              
592             =cut
593              
594             my $cs;
595             sub olson_country_selection() {
596 1   33 1 1 11 return $cs ||= do {
597 1         5 my $fn = _data_file("country_selection.tzp");
598 1 0       3 $@ = ""; do($fn) || die($@ eq "" ? "$fn: $!" : $@);
  1 50       1085  
599             }
600             }
601              
602             =back
603              
604             =head2 Zone data
605              
606             =over
607              
608             =item olson_tzfile(NAME)
609              
610             Returns the pathname of the binary tzfile (in L format)
611             describing the timezone named I in the Olson database. Cs if
612             the name does not exist in this version of the database. The tzfile
613             is of at least version 2 of the format, and so does not suffer a Y2038
614             (32-bit time_t) problem.
615              
616             =cut
617              
618             sub olson_tzfile($) {
619 1199     1199 1 235220 my($tzname) = @_;
620 1199 100       1912 $tzname = olson_links()->{$tzname} if exists olson_links()->{$tzname};
621 1199 100       1943 unless(exists olson_canonical_names()->{$tzname}) {
622 3         24 require Carp;
623 3         8 Carp::croak("no such timezone `$tzname' ".
624 3         561 "in the Olson @{[olson_version]} database");
625             }
626 1196         2441 return _data_file($tzname.".tz");
627             }
628              
629             =back
630              
631             =head1 BUGS
632              
633             The Olson timezone database probably contains errors in the older
634             historical data. These will be corrected, as they are discovered,
635             in future versions of the database.
636              
637             Because legislatures commonly change civil timezone rules, in
638             unpredictable ways and often with little advance notice, the current
639             timezone data is liable to get out of date quite quickly. The Olson
640             timezone database is frequently updated to keep it accurate for current
641             dates. Frequently updating installations of this module from CPAN should
642             keep it similarly accurate.
643              
644             For the same reason, the future data in the database is liable to be
645             very inaccurate. The database includes, for each timezone, the current
646             best guess regarding its future behaviour, usually consisting of the
647             current rules being left unchanged indefinitely. (In most cases it is
648             unlikely that the rules will actually never be changed, but the current
649             rules still constitute the best guess available of future behaviour.)
650              
651             Because this module is intended to be frequently updated, long-running
652             programs (such as clock displays) will experience the module being
653             updated while in use. This can happen with any module, but is of
654             particular interest with this one. The behaviour in this situation is
655             not guaranteed, but here is a guide to current behaviour. The running
656             module code is of course not influenced by the C<.pm> file changing.
657             The ancillary data is all currently stored in the module code, and so
658             will be equally unaffected. Tzfiles pointed to by the module, however,
659             will change visibly. Newly reading a tzfile is liable to see a newer
660             version of the zone's data than the module's metadata suggests. A tzfile
661             could also theoretically disappear, if a zone's canonical name changes
662             (so the former canonical name becomes a link). To avoid weirdness,
663             it is recommended to read in all required tzfiles near the start of
664             a program's run, so that it doesn't matter if the files subsequently
665             change due to an update.
666              
667             =head1 SEE ALSO
668              
669             L,
670             L,
671             L,
672             L,
673             L
674              
675             =head1 AUTHOR
676              
677             The Olson timezone database was compiled by Arthur David Olson, Paul
678             Eggert, and many others. It is maintained by the denizens of the mailing
679             list (formerly ).
680              
681             The C Perl module wrapper for the database was
682             developed by Andrew Main (Zefram) .
683              
684             =head1 COPYRIGHT
685              
686             The Olson timezone database is is the public domain.
687              
688             The C Perl module wrapper for the database is
689             Copyright (C) 2010, 2011, 2012, 2013, 2014, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025
690             Andrew Main (Zefram) .
691              
692             =head1 LICENSE
693              
694             No license is required to do anything with public domain materials.
695              
696             This module is free software; you can redistribute it and/or modify it
697             under the same terms as Perl itself.
698              
699             =cut
700              
701             1;