diff options
Diffstat (limited to 'perl-install/timezone.pm')
-rw-r--r-- | perl-install/timezone.pm | 139 |
1 files changed, 65 insertions, 74 deletions
diff --git a/perl-install/timezone.pm b/perl-install/timezone.pm index e82d6cca5..7fb5303d3 100644 --- a/perl-install/timezone.pm +++ b/perl-install/timezone.pm @@ -9,6 +9,7 @@ use log; sub getTimeZones { my ($prefix) = @_; + $::testing and $prefix = ''; open(my $F, "cd $prefix/usr/share/zoneinfo && find [A-Z]* -type f |"); my @l = chomp_(<$F>); close $F or die "cannot list the available zoneinfos"; @@ -55,85 +56,75 @@ sub write { }); } -my %l2t = ( -'Afrikaans (South Africa)' => 'Africa/Johannesburg', -'Arabic' => 'Africa/Cairo', -'Armenian (Armenia)' => 'Asia/Yerevan', -'Azeri (Azerbaijan)' => 'Asia/Baku', -'Belarussian (Belarus)' => 'Europe/Minsk', -'Bosnian (Bosnia)' => 'Europe/Sarajevo', -'Brezhoneg (Brittany)' => 'Europe/Paris', -'Bulgarian (Bulgaria)' => 'Europe/Sofia', -'Catalan' => 'Europe/Madrid', -'Chinese Traditional (Taiwan)' => 'Asia/Taipei', -'Chinese Simplified (China)' => 'Asia/Beijing', -'Croatian (Bosnia)' => 'Europe/Sarajevo', -'Croatian (Croatia)' => 'Europe/Zagreb', -'Cymraeg (Welsh)' => 'Europe/London', -'Czech' => 'Europe/Prague', -'Danish (Denmark)' => 'Europe/Copenhagen', -'Dutch (Netherlands)' => 'Europe/Amsterdam', -'English (United States)' => 'America/New_York', -'English (United Kingdom)' => 'Europe/London', -'Esperanto' => 'Europe/Warsaw', -'Estonian (Estonia)' => 'Europe/Tallinn', -'Euskara (Basque)' => 'Europe/Madrid', -'Finnish (Finland)' => 'Europe/Helsinki', -'French (France)' => 'Europe/Paris', -'French (Belgium)' => 'Europe/Brussels', -'French (Canada)' => 'Canada/Atlantic', # or Newfoundland ? or Eastern ? -'Gaeilge (Ireland)' => 'Europe/Dublin', -'Galego' => 'Europe/Madrid', -'Georgian (Georgia)' => 'Asia/Yerevan', -'German (Austria)' => 'Europe/Vienna', -'German (Germany)' => 'Europe/Berlin', -'Greek (Greece)' => 'Europe/Athens', -'Greenlandic' => 'Arctic/Longyearbyen', -'Hebrew (Israel)' => 'Asia/Tel_Aviv', -'Hungarian (Hungary)' => 'Europe/Budapest', -'Icelandic (Iceland)' => 'Atlantic/Reykjavik', -'Indonesian (Indonesia)' => 'Asia/Jakarta', -'Iranian (Iran)' => 'Asia/Tehran', -'Italian (Italy)' => 'Europe/Rome', -#-'Italian (San Marino)' => 'Europe/San_Marino', -#-'Italian (Vatican)' => 'Europe/Vatican', -#-'Italian (Switzerland)' => 'Europe/Zurich', -'Japanese (Japon)' => 'Asia/Tokyo', -'Korean (Korea)' => 'Asia/Seoul', -'Latvian (Latvia)' => 'Europe/Riga', -'Lithuanian (Lithuania)' => 'Europe/Vilnius', -'Macedonian (Macedonia)' => 'Europe/Skopje', -'Maori (New Zealand)' => 'Australia/Sydney', -'Norwegian (Bokmaal)' => 'Europe/Oslo', -'Norwegian (Nynorsk)' => 'Europe/Oslo', -'Polish (Poland)' => 'Europe/Warsaw', -'Portuguese (Brazil)' => 'Brazil/East', # most people live on the east coast -'Portuguese (Portugal)' => 'Europe/Lisbon', -'Romanian (Rumania)' => 'Europe/Bucharest', -'Russian (Russia)' => 'Europe/Moscow', -'Serbian (Serbia)' => 'Europe/Belgrade', -'Slovak (Slovakia)' => 'Europe/Bratislava', -'Slovenian (Slovenia)' => 'Europe/Ljubljana', -'Spanish (Argentina)' => 'America/Buenos_Aires', -'Spanish (Mexico)' => 'America/Mexico_City', -'Spanish (Spain)' => 'Europe/Madrid', -'Swedish (Sweden)' => 'Europe/Stockholm', -'Tajik (Tajikistan)' => 'Asia/Dushanbe', -'Tamil (Sri Lanka)' => 'Asia/Colombo', -'Tatar' => 'Europe/Minsk', -'Thai (Thailand)' => 'Asia/Bangkok', -'Turkish (Turkey)' => 'Europe/Istanbul', -'Ukrainian (Ukraine)' => 'Europe/Kiev', -'Uzbek (Uzbekistan)' => 'Asia/Tashkent', -'Vietnamese (Vietnam)' => 'Asia/Saigon', -'Walon (Belgium)' => 'Europe/Brussels', +#- best guesses for a given country +my %c2t = ( +'AM' => 'Asia/Yerevan', +'AR' => 'America/Buenos_Aires', +'AT' => 'Europe/Vienna', +'AU' => 'Australia/Sydney', +'BA' => 'Europe/Sarajevo', +'BE' => 'Europe/Brussels', +'BG' => 'Europe/Sofia', +'BR' => 'Brazil/East', #- most people live on the east coast +'BY' => 'Europe/Minsk', +'CA' => 'Canada/Eastern', +'CH' => 'Europe/Zurich', +'CN' => 'Asia/Beijing', +'CZ' => 'Europe/Prague', +'DE' => 'Europe/Berlin', +'DK' => 'Europe/Copenhagen', +'EE' => 'Europe/Tallinn', +'ES' => 'Europe/Madrid', +'FI' => 'Europe/Helsinki', +'FR' => 'Europe/Paris', +'GB' => 'Europe/London', +'GE' => 'Asia/Yerevan', +'GL' => 'Arctic/Longyearbyen', +'GR' => 'Europe/Athens', +'HR' => 'Europe/Zagreb', +'HU' => 'Europe/Budapest', +'ID' => 'Asia/Jakarta', +'IE' => 'Europe/Dublin', +'IL' => 'Asia/Tel_Aviv', +'IN' => 'Asia/Calcutta', +'IR' => 'Asia/Tehran', +'IS' => 'Atlantic/Reykjavik', +'IT' => 'Europe/Rome', +'JP' => 'Asia/Tokyo', +'KR' => 'Asia/Seoul', +'LT' => 'Europe/Vilnius', +'LV' => 'Europe/Riga', +'MK' => 'Europe/Skopje', +'MT' => 'Europe/Malta', +'MX' => 'America/Mexico_City', +'MY' => 'Asia/Kuala_Lumpur', +'NL' => 'Europe/Amsterdam', +'NO' => 'Europe/Oslo', +'NZ' => 'Pacific/Auckland', +'PL' => 'Europe/Warsaw', +'PT' => 'Europe/Lisbon', +'RO' => 'Europe/Bucharest', +'RU' => 'Europe/Moscow', +'SE' => 'Europe/Stockholm', +'SI' => 'Europe/Ljubljana', +'SK' => 'Europe/Bratislava', +'TH' => 'Asia/Bangkok', +'TJ' => 'Asia/Dushanbe', +'TR' => 'Europe/Istanbul', +'TW' => 'Asia/Taipei', +'UA' => 'Europe/Kiev', +'US' => 'America/New_York', +'UZ' => 'Asia/Tashkent', +'VN' => 'Asia/Saigon', +'YU' => 'Europe/Belgrade', +'ZA' => 'Africa/Johannesburg', ); sub fuzzyChoice { - my ($b, $count) = bestMatchSentence($_[0], keys %l2t); + my ($b, $count) = bestMatchSentence($_[0], keys %c2t); $count ? $b : ''; } -sub bestTimezone { $l2t{fuzzyChoice($_[0])} || 'GMT' } +sub bestTimezone { $c2t{fuzzyChoice($_[0])} || 'GMT' } sub ntp_servers { q(Australia (ntp.adelaide.edu.au) |