From c795d4380f62bf14243de5a41a7d65e6de02f468 Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Sun, 15 Dec 2002 12:12:47 +0000 Subject: [w3m-dev 03574] Re: preserve timestamp * ftp.c (getFtpModtime): don't call localtime,gettime in same expr From: Takahashi Youichirou --- ftp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'ftp.c') diff --git a/ftp.c b/ftp.c index 613a9a1..232c6a6 100644 --- a/ftp.c +++ b/ftp.c @@ -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 #include #include @@ -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 -- cgit v1.2.3