in reply to Re: Timegm and timelocalin thread Timegm and timelocal
You don't need to, but if you do, you don't need to check for negative values afterwards.
You can replace this by:
my $r= $t2-$t1; $r+= 3600 if $r<0; [download]
This code may even be faster because you don't need to divide by 3600.