There is a problem with the array returned by gmtime in perl (RedHat 6.2 + latest perl). The following example prints year 100: Script started on Wed Oct 11 12:07:24 2000 [braun@bastheth braun]$ cat ptime.pl #!/usr/bin/perl ( $sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst ) = gmtime (time()); printf (" Current date is %2d/%2d/%4d .\n",$mon + 1, $mday, $year); [braun@bastheth braun]$ ./ptime.pl ; date Current date is 10/11/ 100 . Wed Oct 11 12:07:45 MEST 2000 [braun@bastheth braun]$ rpm -q perl perl-5.00503-12 [braun@bastheth braun]$ exit Script done on Wed Oct 11 12:08:09 2000
Ok, it could be that $year is the number of years since 1900 (i. e. not a bug). I found similar code in mirror-2.9 (dateconv.pl). Mirror actually sends mails with year 100 in its body. Mirrored rh70updates (ftp.gmd.de:/mirrors/redhat.com/updates/7.0 -> /home/ftp/pub/linux/RedHat/updates/7.0) RedHat Linux Updates @ 11 Oct 100 10:35 Got SRPMS/usermode-1.36-3.src.rpm 59209 1
Not a bug, perl documents this behaviour, from 'perldoc -f gmtime': Note that the $year element is not simply the last two digits of the year. If you assume it is, then you create non-Y2K-compliant programs--and you wouldn't want to do that, would you? The proper way to get a complete 4-digit year is simply: year += 1900;