From 5d32c97ce99fd82b43b2d875d5c787961a096943 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Wed, 26 Jan 2000 12:50:46 +0000 Subject: [PATCH] Fix timestamp handling. Submitted by: bde --- lib/libfetch/ftp.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c index 9f0a8ac3a843..0f45bfadafd7 100644 --- a/lib/libfetch/ftp.c +++ b/lib/libfetch/ftp.c @@ -539,8 +539,6 @@ fetchStatFTP(struct url *url, struct url_stat *us, char *flags) goto ouch; for (ln = last_reply + 4; *ln && isspace(*ln); ln++) /* nothing */ ; - t = time(NULL); - us->mtime = localtime(&t)->tm_gmtoff; sscanf(ln, "%04d%02d%02d%02d%02d%02d", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec); @@ -548,9 +546,13 @@ fetchStatFTP(struct url *url, struct url_stat *us, char *flags) tm.tm_mon--; tm.tm_year -= 1900; tm.tm_isdst = -1; - tm.tm_gmtoff = 0; - us->mtime += mktime(&tm); - us->atime = us->mtime; + t = mktime(&tm); + if (t == (time_t)-1) + t = time(NULL); + else + t += tm.tm_gmtoff; + us->mtime = t; + us->atime = t; return 0; ouch: