From 7f420fb3731a6adc56ab96a934c1f77ffee48e86 Mon Sep 17 00:00:00 2001 From: rsc Date: Sat, 20 May 2006 04:24:24 +0000 Subject: more time zone fixes --- src/lib9/date.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/lib9') diff --git a/src/lib9/date.c b/src/lib9/date.c index 76f4a262..c299202e 100644 --- a/src/lib9/date.c +++ b/src/lib9/date.c @@ -12,12 +12,23 @@ static void dotz(void) { time_t t; + struct tm *gtm; + struct tm tm; if(didtz) return; t = time(0); - tzdelta = t - mktime(gmtime(&t)); strftime(tzone, sizeof tzone, "%Z", localtime(&t)); + tm = *localtime(&t); /* set local time zone field */ + gtm = gmtime(&t); + tm.tm_sec = gtm->tm_sec; + tm.tm_min = gtm->tm_min; + tm.tm_hour = gtm->tm_hour; + tm.tm_mday = gtm->tm_mday; + tm.tm_mon = gtm->tm_mon; + tm.tm_year = gtm->tm_year; + tm.tm_wday = gtm->tm_wday; + tzdelta = t - mktime(&tm); } static void -- cgit v1.2.3