summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2000-01-26 12:50:46 +0000
committerdes <des@FreeBSD.org>2000-01-26 12:50:46 +0000
commite81fbe2ad98e00d775b6aaddd88033e640810067 (patch)
treed2a73198490d0eb9bfa639d899683a2f19972a47 /lib
parent8e057fffb8688cf1a512ff6435801037878a3e1e (diff)
downloadFreeBSD-src-e81fbe2ad98e00d775b6aaddd88033e640810067.zip
FreeBSD-src-e81fbe2ad98e00d775b6aaddd88033e640810067.tar.gz
Fix timestamp handling.
Submitted by: bde
Diffstat (limited to 'lib')
-rw-r--r--lib/libfetch/ftp.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c
index 9f0a8ac..0f45bfa 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:
OpenPOWER on IntegriCloud