Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Create aliases for quick timezone checks' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create aliases for quick timezone checks
Authored by: ilovja on Aug 28, '03 11:46:24PM

dang... geeklog ate up backslashes when I posted as HTML, though it was okay when I previewed it.

#!/usr/bin/perl -w

use strict;
use File::Find;
use File::Basename;

my $zoneDir="/usr/share/zoneinfo";
my $city = shift || die "Usage: itime city\n";
find(\&wanted, $zoneDir);

sub wanted {
if ( -f $_ && $_ =~ /$city/i ) {
$ENV{'TZ'}=basename($File::Find::dir)."/$_";
my $time=localtime();
print "$_ $time\n";
}
}



[ Reply to This | # ]