summaryrefslogtreecommitdiff
path: root/source4/lib/replace
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-09-27 02:36:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:39:00 -0500
commita2dffe109bc989c5a610d610a2f1a31f10d65968 (patch)
tree2f92e1fb93cea8c6f5f0688959b7677a4268d5cd /source4/lib/replace
parent251aaafe3a9213118ac3a92def9ab2104c40d12a (diff)
downloadsamba-a2dffe109bc989c5a610d610a2f1a31f10d65968.tar.gz
samba-a2dffe109bc989c5a610d610a2f1a31f10d65968.tar.bz2
samba-a2dffe109bc989c5a610d610a2f1a31f10d65968.zip
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)
Diffstat (limited to 'source4/lib/replace')
-rw-r--r--source4/lib/replace/replace.c14
1 files changed, 2 insertions, 12 deletions
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