#!/usr/bin/perl print "Content-type:text/html\n\n"; # 1 year is equal to 31536000 seconds, so multiply that by 30. $y2k = 31536000 * 30; # now loop through the years, adding one day (86400 seconds) for each # leap year foreach $i (1970..1999) { if (($i % 4) == 0) { $y2k = $y2k + 86400; } } $current = time(); @timery = localtime($current); # local time zone (central) is 6 hours off of GMT, so add 6 hours to get our Y2K time. $y2k = $y2k + (3600*6); print "Current time is: ", scalar localtime($current), "
\n"; print "Y2K: ", scalar localtime($y2k), "
\n"; if ($current < $y2k) { # it's not y2k yet. print out how much time is left. ($secs,$mins,$hrs,$days,$weeks,$mos) = &calc_time($y2k-$current); print "There are $weeks weeks, $days days, $hrs hours, $mins minutes, and $secs seconds left until January 1, 2000.\n"; } else { # it's already passed. print out how much time has passed. ($secs,$mins,$hrs,$days,$weeks) = &calc_time($current-$y2k); print "$weeks weeks, $days days, $hrs hours, $mins minutes, and $secs seconds have elapsed since January 1, 2000.\n"; } sub calc_time { ($mytime) = @_; # all this does is divides $mytime (the raw seconds) into hours, mins, etc. $weeks = int($mytime / 604800); $mytime = $mytime - (604800 * $weeks); $days = int($mytime / 86400); $mytime = $mytime - (86400 * $days); $hrs = int($mytime / 3600); $mytime = $mytime - (3600 * $hrs); $mins = int($mytime / 60); $secs = $mytime - (60 * $mins); return ($secs,$mins,$hrs,$days,$weeks); }