<div dir="ltr"><div><div><div>I've attached a potentially useful script; it also appears in tab-mangled form below; it's designed to identify time zones that are the same in the long run.<br><br></div>Given the name of a zone.tab file and the name of a time-zone-binary directory, the script runs through the zones mentioned in zone.tab and finds the associated POSIX string that applies after the last transition time specified in the zone's binary file. Each line of output begins with a POSIX string, followed by the name of each zone to which that string applies; output is sorted by POSIX string. So:<br>
<br> AFT-4:30 Asia/Kabul<br> AKST9AKDT,M3.2.0,M11.1.0 America/Anchorage America/Juneau America/Sitka America/Yakutat America/Nome<br> ...<br><br></div>There's surely room for improvement.<br><br></div> @dashdashado<br>
<br>#!/bin/perl<br><br>my $O = $0;<br><br>$O =~ s@.*[\/\\]@@;<br>$O =~ s@.pl$@@i;<br><br>if ($#ARGV != 1) {<br> printf STDERR "$O: usage is $O zone.tab tz-binary-directory\n";<br> exit(1);<br>}<br><br>my ($zonetab, $tzdir) = @ARGV;<br>
<br>open(S, "<$zonetab") || die("cannot open $zonetab");<br>while(<S>) {<br> s@[\r\n]@@g;<br> s@\s*#.*@@;<br> $zone = (split())[2];<br> $zone eq "" && next;<br> $binary = "$tzdir/$zone";<br>
open(T, "<$binary") || die("cannot open $binary");<br> $posix = ();<br> while (<T>) {<br> $posix = $_;<br> }<br> close(T);<br> $posix =~ s@[\r\n]@@g;<br> if ($posix eq "") {<br>
$posix = $zone;<br> }<br> $result = $results{$posix};<br> if ($result ne "") {<br> $result .= " ";<br> }<br> $result .= $zone;<br> $results{$posix} = $result;<br>}<br>close(S);<br>
<br>foreach (sort keys %results) {<br> print "$_\t$results{$_}\n";<br>}<br><br><br>exit(0);<br><br><br></div>