]> sjero.net Git - wget/commitdiff
[svn] The AM/PM change did assume 12:01PM == 00:01, which was obviously
authorjanp <devnull@localhost>
Sun, 8 Apr 2001 14:36:58 +0000 (07:36 -0700)
committerjanp <devnull@localhost>
Sun, 8 Apr 2001 14:36:58 +0000 (07:36 -0700)
wrong. Taken care of this anomaly.

src/ftp-ls.c

index 22d1887aaba48ca458321b6e7993b503ce2a81bc..e65ddb2c2f72236396b4163eaaa9464d01c418db 100644 (file)
@@ -456,9 +456,11 @@ ftp_parse_winnt_ls (const char *file)
       hour = atoi(tok);
       tok = strtok(NULL,  "M");
       min = atoi(tok);
       hour = atoi(tok);
       tok = strtok(NULL,  "M");
       min = atoi(tok);
-      /* Adjust hour from AM/PM */
+      /* Adjust hour from AM/PM. Just for the record, the sequence goes
+         11:00AM, 12:00PM, 01:00PM ... 11:00PM, 12:00AM, 01:00AM . */
       tok+=2;
       tok+=2;
-      if (*tok == 'P') hour = (hour + 12) % 24;
+      if      ((*tok == 'A') && (hour == 12)) hour  = 0;
+      else if ((*tok == 'P') && (hour <  12)) hour += 12;
 
       DEBUGP(("YYYY/MM/DD HH:MM - %d/%02d/%02d %02d:%02d\n", 
               year+1900, month, day, hour, min));
 
       DEBUGP(("YYYY/MM/DD HH:MM - %d/%02d/%02d %02d:%02d\n", 
               year+1900, month, day, hour, min));