On Thu, Jun 14, 2012 at 05:13:04PM +0100, Paul LeoNerd Evans wrote: > Time::Local complains about out-of-range values. It cannot do 25th hour > or -3rd day or whatever. Time::mkgmtime specifically allows these, the > same way POSIX::mktime() does.
To wit, the -3rd hour of the 12th June 2012: $ perl -MTime::mkgmtime=mkgmtime -E 'say scalar gmtime mkgmtime 0,0,-3,12,6-1,2012-1900' Mon Jun 11 21:00:00 2012 $ perl -MTime::Local=timegm -E 'say scalar gmtime timegm 0,0,-3,12,6-1,2012-1900' Hour '-3' out of range 0..23 at -e line 1 This behaviour is very much required. It allows one to perform all kinds of simple date/time arithmetic; e.g: sub midnight_four_days_ago { my @t = gmtime; $t[3] -= 4; $t[0]=$t[1]=$t[2] = 0; return mkgmtime @t; } -- Paul "LeoNerd" Evans leon...@leonerd.org.uk ICQ# 4135350 | Registered Linux# 179460 http://www.leonerd.org.uk/
signature.asc
Description: Digital signature