Re: Time::Local problem

2004-08-30 Thread Rick Measham
On 30 Aug 2004, at 8:15 PM, David Ledger wrote:
Can anyone explain the following? (the difference in commands is the 
year spec.)

[EMAIL PROTECTED]: perl -e 'use Time::Local;print ( (localtime(timelocal(0, 0, 
0, 1, 1, 55)))[6], \n);'
2
[EMAIL PROTECTED]: perl -e 'use Time::Local;print ( (localtime(timelocal(0, 0, 
0, 1, 1, 54)))[6], \n);'
Cannot handle date (0, 0, 0, 1, 1, 2054) at -e line 1
[EMAIL PROTECTED]:

All years I've tried  55 are Ok; all years I've tried  54 fail.
As Sherm has pointed out, it's due to the two-digit year wrap around. 
(Remember the so-called Millennium bug? That's what you're perpetuating 
in the above code)

Your best bet for anything to do with dates and times is to use the 
DateTime modules. They work on all platforms and comprehensively handle 
any date and time you can throw at it (right up to $MAXINT-12-31). They 
handle localization and know all current and historic DST rules back to 
1972.

Cheers!
Rick Measham
(disclaimer: I have developed some of the DateTime modules)
Senior Developer
PrintSupply - Print Procurement  Supply Management
18 Greenaway Street VIC 3105
Tel: (03) 9850 3255
Fx: (03) 9850 3277
http://www.printsupply.com.au/



Re: Time::Local problem

2004-08-30 Thread Sherm Pendley
On Aug 30, 2004, at 7:01 PM, Rick Measham wrote:
Your best bet for anything to do with dates and times is to use the 
DateTime modules. They work on all platforms and comprehensively 
handle any date and time you can throw at it (right up to 
$MAXINT-12-31).
Great - so now our ancestors have to deal with the Y4G bug? ;-)
sherm--


Re: Time::Local problem

2004-08-30 Thread Rick Measham
On 31 Aug 2004, at 12:09 PM, Sherm Pendley wrote:
Great - so now our ancestors have to deal with the Y4G bug? ;-)
LOL .. no .. unless you continue to abbreviate. The dates will range 
from 1-01-01 to 1-12-31 and 2004 will mean 2004 not 12004.

Cheers!
Rick
(They're your decedents by the way, your ancestors have stopped 
counting)

Senior Developer
PrintSupply - Print Procurement  Supply Management
18 Greenaway Street VIC 3105
Tel: (03) 9850 3255
Fx: (03) 9850 3277
http://www.printsupply.com.au/