X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fctime.pl;h=6a3f295968670ecb143024d2d6ac6b8ec80f46c2;hb=07be1b83a6b2d24b492356181ddf70e1c7917ae3;hp=988d05a84170a267b1a43fe0aba8473baa0aa22d;hpb=fe14fcc35f78a371a174a1d14256c2f35ae4262b;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/ctime.pl b/lib/ctime.pl index 988d05a..6a3f295 100644 --- a/lib/ctime.pl +++ b/lib/ctime.pl @@ -1,9 +1,17 @@ ;# ctime.pl is a simple Perl emulation for the well known ctime(3C) function. +# +# This library is no longer being maintained, and is included for backward +# compatibility with Perl 4 programs which may require it. +# +# In particular, this should not be used as an example of modern Perl +# programming techniques. +# +# Suggested alternative: the POSIX ctime function ;# ;# Waldemar Kebsch, Federal Republic of Germany, November 1988 ;# kebsch.pad@nixpbe.UUCP ;# Modified March 1990, Feb 1991 to properly handle timezones -;# $Id: ctime.pl,v 1.8 91/02/04 18:28:12 hakanson Exp $ +;# $RCSfile: ctime.pl,v $$Revision: 4.1 $$Date: 92/08/07 18:23:47 $ ;# Marion Hakanson (hakanson@cse.ogi.edu) ;# Oregon Graduate Institute of Science and Technology ;# @@ -24,6 +32,7 @@ sub ctime { package ctime; local($time) = @_; + local($[) = 0; local($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst); # Determine what time zone is in effect. @@ -43,7 +52,7 @@ sub ctime { } $TZ .= ' ' unless $TZ eq ''; - $year += ($year < 70) ? 2000 : 1900; + $year += 1900; sprintf("%s %s %2d %2d:%02d:%02d %s%4d\n", $DoW[$wday], $MoY[$mon], $mday, $hour, $min, $sec, $TZ, $year); }