diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-12-15 12:12:47 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-12-15 12:12:47 +0000 |
commit | c795d4380f62bf14243de5a41a7d65e6de02f468 (patch) | |
tree | 995b3bd9d9b5dd9e18674f98c409cde8aa9948e5 /ftp.c | |
parent | [w3m-dev 03573] Re: Bug#172851: w3m: In form, takes hostname as baseref for r... (diff) | |
download | w3m-c795d4380f62bf14243de5a41a7d65e6de02f468.tar.gz w3m-c795d4380f62bf14243de5a41a7d65e6de02f468.zip |
[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 (limited to 'ftp.c')
-rw-r--r-- | ftp.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1,4 +1,4 @@ -/* $Id: ftp.c,v 1.17 2002/12/14 15:26:44 ukai Exp $ */ +/* $Id: ftp.c,v 1.18 2002/12/15 12:12:47 ukai Exp $ */ #include <stdio.h> #include <pwd.h> #include <Str.h> @@ -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 |