commit cd4ef96ea305b6b1575f61d9063b1ea29e96102e
parent 74c27157651184d5e4d6e67f3160f4451b1f5fca
Author: ukai <ukai>
Date: Sun, 15 Dec 2002 12:12:47 +0000
[w3m-dev 03574] Re: preserve timestamp
* ftp.c (getFtpModtime): don't call localtime,gettime in same expr
From: Takahashi Youichirou <nikuq@hk.airnet.ne.jp>
Diffstat:
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,8 @@
+2002-12-15 Takahashi Youichirou <nikuq@hk.airnet.ne.jp>
+
+ * [w3m-dev 03574] Re: preserve timestamp
+ * ftp.c (getFtpModtime): don't call localtime,gettime in same expr
+
2002-12-15 Fumitoshi UKAI <ukai@debian.or.jp>
* [w3m-dev 03573] Re: Bug#172851: w3m: In form, takes hostname as baseref for relative URI action
diff --git a/ftp.c b/ftp.c
@@ -357,7 +357,7 @@ getFtpModtime(FTP ftp, char *path)
Str tmp;
char *p;
struct tm tm;
- time_t t;
+ time_t t, lt, gt;
memset(&tm, 0, sizeof(struct tm));
tmp = Sprintf("MDTM %s\r\n", path);
@@ -374,8 +374,9 @@ getFtpModtime(FTP ftp, char *path)
tm.tm_year -= 1900;
tm.tm_mon--;
t = mktime(&tm);
- t += mktime(localtime(&t)) - mktime(gmtime(&t));
- return t;
+ lt = mktime(localtime(&t));
+ gt = mktime(gmtime(&t));
+ return t + (lt - gt);
}
int