[wget-notify] [bug #21505] Date-parsing issues with FTP

Micah Cowan INVALID.NOREPLY at gnu.org
Fri Nov 2 09:23:13 PDT 2007


URL:
  <http://savannah.gnu.org/bugs/?21505>

                 Summary: Date-parsing issues with FTP
                 Project: GNU Wget
            Submitted by: micahcowan
            Submitted on: Friday 11/02/2007 at 09:23
                Category: Program Logic
                Severity: 2 - Minor
                Priority: 5 - Normal
                  Status: Confirmed
                 Privacy: Public
             Assigned to: None
         Originator Name: Philip Gladstone
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 1.10.2
        Operating System: None
         Reproducibility: None
           Fixed Release: None
         Planned Release: 1.12
              Regression: No
           Work Required: 0 - Hours
          Patch Included: Yes

    _______________________________________________________

Details:

>From patches ML, Philip Gladstone writes:

Brief outline:

When you do a wget from an ftp: url, it tries to copy over the last modified
date of the file (this is good). However, due to timezone issues, the date
that it gets can sometimes be in the future, and then it guesses the year
incorrectly. This patch fixes that problem.


--- wget-1.10.2/src/ftp-ls.c	2005-08-04 17:52:33.000000000 -0400
+++ wget-1.10.2-fixed/src/ftp-ls.c	2006-10-28 15:09:58.000000000 -0400
@@ -410,10 +410,19 @@
 	     is 97-01-12, and you see a file of Dec 15th, its year is
 	     1996, not 1997.  Thanks to Vladimir Volovich for
 	     mentioning this!  */
-	  if (month > tnow->tm_mon)
-	    timestruct.tm_year = tnow->tm_year - 1;
-	  else
-	    timestruct.tm_year = tnow->tm_year;
+          /* However, due to timezone differences, you can get files for 
+             up to 24 hours in the future. If these cross a month or year
+             end, then you have problems - pjsg */
+          if (day == 1 && month == ((tnow->tm_mon + 1) % 12))
+            if (month == 0)
+	      timestruct.tm_year = tnow->tm_year + 1;
+            else
+	      timestruct.tm_year = tnow->tm_year;
+          else
+	    if (month > tnow->tm_mon)
+	      timestruct.tm_year = tnow->tm_year - 1;
+	    else
+	      timestruct.tm_year = tnow->tm_year;
 	}
       else
 	timestruct.tm_year = year;





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?21505>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



More information about the wget-notify mailing list