Tk Library Source Code

Artifact [24ae873acc]
Login

Artifact 24ae873acc7bef7b51b266efce81be1f8951b384:

Attachment "ftp_modtimepp.diff" to ticket [478478ffff] added by andreas_kupries 2001-11-07 11:33:20.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcllib/tcllib/ChangeLog,v
retrieving revision 1.70
diff -u -r1.70 ChangeLog
--- ChangeLog	2001/11/07 02:48:29	1.70
+++ ChangeLog	2001/11/07 03:44:58
@@ -1,3 +1,7 @@
+2001-11-06  Tcl Project  <[email protected]>
+
+	* ftp: Applied #478478
+
 2001-11-04  Andreas Kupries  <[email protected]>
 
 	* ftp: Fixed bug #476729.
Index: modules/ftp/ChangeLog
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/ftp/ChangeLog,v
retrieving revision 1.17
diff -u -r1.17 ChangeLog
--- modules/ftp/ChangeLog	2001/11/07 02:48:29	1.17
+++ modules/ftp/ChangeLog	2001/11/07 03:44:58
@@ -1,3 +1,9 @@
+2001-11-06  Tcl Project  <[email protected]>
+
+	* ftp.tcl: Applied patch in #478478 to handle non-standard date
+	  information from servers with a buggy y2k patch. 2001 is
+	  rendered as 19101 (19*100 + 101 = 2001).
+
 2001-11-04  Andreas Kupries <[email protected]>
 
 	* ftp.n: Updated description of DisplayMsg to the changed
Index: modules/ftp/ftp.tcl
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/ftp/ftp.tcl,v
retrieving revision 1.17
diff -u -r1.17 ftp.tcl
--- modules/ftp/ftp.tcl	2001/11/07 02:48:29	1.17
+++ modules/ftp/ftp.tcl	2001/11/07 03:44:58
@@ -1333,9 +1333,22 @@
     }
 }
 
-proc ftp::ModTimePostProcess clock {
+proc ftp::ModTimePostProcess {clock} {
+    variable VERBOSE
+
     foreach {year month day hour min sec} {1 1 1 1 1 1} break
-    scan $clock "%4s%2s%2s%2s%2s%2s" year month day hour min sec
+
+    # Bug #478478. Special code to detect ftp servers with a Y2K patch
+    # gone bad and delivering, hmmm, non-standard date information.
+
+    if {[string length $clock] == 15} {
+        scan $clock "%2s%3s%2s%2s%2s%2s%2s" cent year month day hour min sec
+        set year [expr ($cent * 100) + $year]
+	log::log warning "data | W: server with non-standard time, bad Y2K patch."
+    } else {
+        scan $clock "%4s%2s%2s%2s%2s%2s" year month day hour min sec
+    }
+
     set clock [clock scan "$month/$day/$year $hour:$min:$sec" -gmt 1]
     return $clock
 }