Curious dating behavior in PMMail 2000

Steve Lamb pmmail@rpglink.com
Fri, 31 Mar 2000 23:31:12 -0800


On Fri, Mar 31, 2000 at 04:56:03PM -0800, Chris Adams wrote:
> Of course, as a lot of Y2k remediation showed, the Unix system designers
> being smart doesn't mean that all Unix programmers were also smart.
> Entirely too many of them did something stupid anyway...

    The most common question after y2k was why perl wasn't y2k compliant.  A
lot of people were bitching about it.  Here's the problem:

@time = localtime(time);
print("19$time[5]\n") # bad
$correctyear = 1900+$time[5];
print("$correctyear]n\n"); #will even work after y2k
print("$time[4]/$time[3]/$time[5]\n"); #bad
$correctyear = substr($time[5],2,2);
print("$correctyear/$time[3]/$time[5]\n"); #better

    In short, Perl returns the current year -1900.  So after y2k people had
programs spewing 19100 or 01/01/100.  Perl was y2k compliant, the code made
with it was not.

-- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
         ICQ: 5107343          | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------