[WEB4LIB] formmail.pl and non-Y2K cgi scripts

Darryl Friesen Darryl.Friesen at usask.ca
Tue Nov 16 09:47:07 EST 1999


> has a line in it that presents a Y2K problem:
>
> $year += 1900;
>
> Someone who knows far more about perl than I do tells me that this
> particular line isn't a showstopper, since this variable effects the
> date printed in the message body, whereas the message header uses a
> date defined by the mail server (which is presumably Y2K compliant.)
> His recommended action was just to change 1900 to 2000 after
> 1/1/2000.

No, the script is correct as is.  Changing the 1900 to 2000 as you suggest
will definitely _make_ it non-Y2K compliant.

A few lines above the line you point out is this:

  ($sec,$min,$hour,$mday,$mon,$year,$wday) =
(localtime(time))[0,1,2,3,4,5,6];

The year returned by the localtime() function is the number of years since
1900.  So in 2000 the number returned will be 100.  To get a full 4 digit
year you must add 1900.


- Darryl

 ----------------------------------------------------------------------
  Darryl Friesen, B.Sc.                        Darryl.Friesen at usask.ca
  Programmer/Analyst                            http://gollum.usask.ca/
  Consulting & Development, Computing Services
  University of Saskatchewan                   "The Truth Is Out There"
 ----------------------------------------------------------------------







More information about the Web4lib mailing list