The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers > Answers to Frequently Asked Questions > Tips and Tutorials
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 02-19-2007
Perderabo's Avatar
Perderabo Perderabo is offline
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,452
My Perl script

Here is my Perl script that I used in this article...
Code:
#! /usr/local/bin/perl


sub printtime($)
{
        @d=localtime $_[0];
        printf "%12d  %3s %4d-%02d-%02d %02d:%02d:%02d %s\n", $_[0],
                (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$d[6]],
                $d[5]+1900,$d[4]+1,$d[3],$d[2],$d[1],$d[0],
                ("Standard Time","Daylight Saving Time")[$d[8]];
}

while (do {print "Enter val - "; chomp($val = <>)}) {
        print "val = ", $val, "\n";
        printtime $val;
        printtime $val+1;

}
print "\n";
This is how I verify that the timezone data is correct. I just calculate by hand the second when I expect the Daylight Saving to toggle and I use this script to see if it does...