diff options
author | des <des@FreeBSD.org> | 2000-01-26 12:50:46 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2000-01-26 12:50:46 +0000 |
commit | e81fbe2ad98e00d775b6aaddd88033e640810067 (patch) | |
tree | d2a73198490d0eb9bfa639d899683a2f19972a47 /lib | |
parent | 8e057fffb8688cf1a512ff6435801037878a3e1e (diff) | |
download | FreeBSD-src-e81fbe2ad98e00d775b6aaddd88033e640810067.zip FreeBSD-src-e81fbe2ad98e00d775b6aaddd88033e640810067.tar.gz |
Fix timestamp handling.
Submitted by: bde
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libfetch/ftp.c | 12 |
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: |