#!/usr/bin/perl use Time::Local; # check for DST adjustments in 2007. # Begins 3/11, ends 11/4. # On each day, check 1AM, then check 1AM+1hr (as opposed to 2AM) # Convert back to dates and compare hours. # # David Torrey %checks = ( # deltaHour => dateStrList 2 => [ '3/11/2007' ], # spring forward = 1AM,3AM 0 => [ '11/4/2007' ] # fall back = 1AM,1AM ); foreach $timechange (keys %checks) { my @dates = @{$checks{$timechange}}; foreach $date (@dates) { my ($month, $day, $year) = split(/\//,$date); # cheat by adding a day's worth of seconds. $oneAM = timelocal(0,0,1,$day,$month-1,$year); $oneAMhour = (localtime($oneAM))[2]; $twoAMhour = (localtime($oneAM+3600))[2]; $delta = $twoAMhour - $oneAMhour; if($delta == $timechange) { print "$date: change okay\n"; } else { print "$date: not correct\n"; } } }