From a2dffe109bc989c5a610d610a2f1a31f10d65968 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 27 Sep 2005 02:36:56 +0000 Subject: r10523: fixed timegm() to not depend on get_time_zone(), so it works in lib/replace/ the old timegm() replacement was also broken (it returned the wrong value) (This used to be commit 342489a1d4d5cc4b16cf2e5ff7e671326f0cb3d5) --- source4/lib/replace/replace.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/replace.c b/source4/lib/replace/replace.c index c53b5a5727..5e60252a67 100644 --- a/source4/lib/replace/replace.c +++ b/source4/lib/replace/replace.c @@ -369,18 +369,8 @@ duplicate a string */ time_t timegm(struct tm *tm) { - struct tm tm2, tm3; - time_t t; - - tm2 = *tm; - - t = mktime(&tm2); - tm3 = *localtime(&t); - tm2 = *tm; - tm2.tm_isdst = tm3.tm_isdst; - t = mktime(&tm2); - t -= get_time_zone(t); - + time_t t = mktime(tm); + t -= mktime(gmtime(&t)) - (int)mktime(localtime(&t)); return t; } #endif -- cgit