[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: Y2K patch for Net::FTP



On Tue, Jan 11, 2000 at 12:12:21PM -0500, WORENKLEIN, David, GCM wrote:
> Since not everyone has their acts together...

I have attached the change that is included in the next libnet release.

Graham.
==== //depot/libnet/Net/FTP.pm#42 (ktext) - //depot/libnet/Net/FTP.pm#43 (ktext) ==== content
Index: libnet/Net/FTP.pm
--- libnet/Net/FTP.pm.~1~	Tue Jan 11 17:32:08 2000
+++ libnet/Net/FTP.pm	Tue Jan 11 17:32:08 2000
@@ -21,7 +21,7 @@
 use Net::Config;
 # use AutoLoader qw(AUTOLOAD);
 
-$VERSION = "2.53"; # $Id$
+$VERSION = "2.54"; # $Id$
 @ISA     = qw(Exporter Net::Cmd IO::Socket::INET);
 
 # Someday I will "use constant", when I am not bothered to much about
@@ -186,9 +186,17 @@
 {
  my $ftp  = shift;
  my $file = shift;
+
+ # Server Y2K bug workaround
+ #
+ # sigh; some idiotic FTP servers use ("19%d",tm.tm_year) instead of 
+ # ("%d",tm.tm_year+1900).  This results in an extra digit in the
+ # string returned. To account for this we allow an optional extra
+ # digit in the year. Then if the first two digits are 19 we use the
+ # remainder, otherwise we subtract 1900 from the whole year.
 
- $ftp->_MDTM($file) && $ftp->message =~ /(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/
-    ? timegm($6,$5,$4,$3,$2-1,$1 - 1900)
+ $ftp->_MDTM($file) && $ftp->message =~ /((\d\d)(\d\d\d?))(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/
+    ? timegm($8,$7,$6,$5,$4-1,$2 eq '19' ? $3 : ($1-1900))
     : undef;
 }
 
End of Patch.

References to:
"WORENKLEIN, David, GCM" <David.Worenklein@gcm.com>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]