Year 2000 compliance fixes for scripts affected by the localtime() date bug.
Some scripts had Y2K issues where dates appeared as "19100" instead of "2000". This was due to a misunderstanding of Perl's localtime() function, which returns years as "years since 1900" (e.g., 100 for year 2000).
Affected scripts: WWWBoard, Countdown, Counter, Free for all Links, TextClock, TextCounter
Lines 222-230 of wwwboard.pl should be changed from:
if ($use_time == 1) {
$date = "$hour\:$min\:$sec $month/$mday/$year";
}
else {
$date = "$month/$mday/$year";
}
chop($date) if ($date =~ /\n$/);
$long_date = "$months[$mon] $mday, 19$year at $hour\:$min\:$sec";
To:
$year += 1900;
$long_date = sprintf("%s %02d, %4d at %02d:%02d:%02d",$months[$mon],$mday,$year,$hour,$min,$sec);
$year %= 100;
if ($use_time == 1) {
$date = sprintf("%02d:%02d:%02d %02d/%02d/%02d",$hour,$min,$sec,$month,$mday,$year);
}
else {
$date = sprintf("%02d/%02d/%02d",$month,$mday,$year);
}
If using WWWBoard as modified by DBasics, also change the line:
if (length($dd) ==1) { $dd="0$dd"; }
To:
if (length($dd) ==1) { $dd="0$dd"; }
$yy %= 100;
Line 65 in countdown.pl should be changed from:
$year ="19$year";
To:
$year += 1900;
Lines 120-132 (subroutine leap_year_check) should be changed from:
sub leap_year_check {
$yeardiv = ($year / 4);
$yearint = int($yeardiv);
$yeardiv1 = ($year / 100);
$yearint1 = int($yeardiv1);
if ($yeardiv eq $yearint && $yeardiv1 ne $yearint1) {
$feb_days = "28";
}
else {
$feb_days = "29";
}
}
To:
sub leap_year_check {
if ($year % 4 != 0 || ($year % 100 == 0 && $year % 400 != 0)) {
$feb_days = "28";
}
else {
$feb_days = "29";
}
}
Line 68 of counter.pl should be changed from:
$date = "$hour\:$min\:$sec $mon/$mday/$year";
To:
$year %= 100;
$date = sprintf("%02d:%02d:%02d %02d/%02d/%02d",$hour,$min,$sec,$mon,$mday,$year);
After line 46 in htmllog.pl:
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$mon++;
Line 57 should be changed from:
$date_now = "$hour\:$min\:$sec $mon/$mday/$year";
To:
$year %= 100;
$date_now = sprintf("%02d:%02d:%02d %02d/%02d/%02d",$hour,$min,$sec,$mon,$mday,$year);
Line 96 in links.pl should be changed from:
$date = "on $days[$wday], $months[$mon] $mday, 19$year at $hour:$min:$sec";
To:
$year += 1900;
$date = "on $days[$wday], $months[$mon] $mday, $year at $hour:$min:$sec";
Lines 80-88 of textclock.pl:
if ($Year > 95) {
$Year = "19$Year";
}
elsif ($Year < 10) {
$Year = "200$Year";
}
else {
$Year = "20$Year";
}
Should be replaced with the single line:
$Year += 1900;
Line 192 of counter.pl should be changed from:
$date = "@months[$mon] $mday, 19$year";
To:
$year += 1900;
$date = "$months[$mon] $mday, $year";