#!/usr/bin/perl # Copyright (c) 2008-2026 Sullivan Beck. All rights reserved. # This program is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. ############################################################################### ############################################################################### # This script will check windows timezone information. my $url = 'https://raw.githubusercontent.com/unicode-org/cldr/main/common/supplemental/windowsZones.xml'; my $new = 'windowsZones.xml'; require "./data.alias.pl"; use lib "../lib"; use Date::Manip::Zones; # %Date::Manip::Zones::Alias ############################################################################ # MAIN PROGRAM ############################################################################ system("wget $url"); my %old = %windows_zones; my %new = _parse($new); # Find deprecated zones my @old; foreach my $key (keys %old) { next if (exists $new{$key}); push(@old,$key); } if (@old) { print "The following zones need to be removed:\n"; foreach my $key (sort @old) { print " $key\n"; delete $old{$key}; } print "\n"; } # Find new zones my @new; foreach my $key (keys %new) { next if (exists $old{$key}); push(@new,$key); } if (@new) { print "The following zones need to be added (check that the zones are in tzdata):\n"; foreach my $key (sort @new) { my $val = $new{$key}; print " \"$key\"" . " "x(32-length($key)) . "=> \"$val\",\n"; delete $new{$key}; } print "\n"; } # Find changed zones my @chg; foreach my $key (keys %old) { next if ($old{$key} eq $new{$key}); push(@chg,$key); } if (@chg) { print "The following zones need to be changed (verify in tzdata first):\n"; foreach my $key (sort @chg) { my $val = $new{$key}; print " \"$key\"" . " "x(32-length($key)) . "=> \"$val\",\n"; } print "\n"; } unlink $new; ############################################################################ ############################################################################ # Looks for lines of the form: # # and creates # ALIAS => ZONE # # ALIAS may be used mltiple times so only the first is used. # sub _parse { my($file) = @_; my %ret; my @lines = `cat $file`; chomp(@lines); foreach my $line (@lines) { if ($line =~ /