X-Git-Url: http://sjero.net/git/?a=blobdiff_plain;f=src%2Fftp-ls.c;h=ca7f43f5ab9030f8d95403a7e03b81a90d3a94f5;hb=568b5842714d0da3e9ad50e84cf09ba55c74572c;hp=d40261e8fe7a54ffbf2966af350bab7e89693898;hpb=004b339d2ebb249f6b12c3bd90c489e3909570ba;p=wget diff --git a/src/ftp-ls.c b/src/ftp-ls.c index d40261e8..ca7f43f5 100644 --- a/src/ftp-ls.c +++ b/src/ftp-ls.c @@ -31,7 +31,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ # include #endif #include -#include #include #include "wget.h" @@ -411,7 +410,7 @@ ftp_parse_winnt_ls (const char *file) FILE *fp; int len; int year, month, day; /* for time analysis */ - int hour, min, sec; + int hour, min; struct tm timestruct; char *line, *tok; /* tokenizer */ @@ -451,22 +450,23 @@ ftp_parse_winnt_ls (const char *file) /* Assuming the epoch starting at 1.1.1970 */ if (year <= 70) year += 100; - /* Second column: hh:mm[AP]M */ + /* Second column: hh:mm[AP]M, listing does not contain value for + seconds */ tok = strtok(NULL, ":"); 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; + if (hour == 12) hour = 0; if (*tok == 'P') hour += 12; - /* Listing does not contain value for seconds */ - sec = 0; DEBUGP(("YYYY/MM/DD HH:MM - %d/%02d/%02d %02d:%02d\n", year+1900, month, day, hour, min)); /* Build the time-stamp (copy & paste from above) */ - timestruct.tm_sec = sec; + timestruct.tm_sec = 0; timestruct.tm_min = min; timestruct.tm_hour = hour; timestruct.tm_mday = day;