summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-10-30 12:03:40 +0000
committerAndrew Tridgell <tridge@samba.org>2002-10-30 12:03:40 +0000
commit809f740166e4c71e7b7027c626336d1e4c58f485 (patch)
tree92ea2d7d81f17360eb2af6b102abac89f4ea4e56 /source3/lib
parent567d1d7c211925e82b9384c2c3ada527ab5334c8 (diff)
downloadsamba-809f740166e4c71e7b7027c626336d1e4c58f485.tar.gz
samba-809f740166e4c71e7b7027c626336d1e4c58f485.tar.bz2
samba-809f740166e4c71e7b7027c626336d1e4c58f485.zip
added a timegm() function for systems that don't have it
(This used to be commit 732bc4519f1119100607cc84400e8f84e0c0ba9d)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/replace.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source3/lib/replace.c b/source3/lib/replace.c
index fd7b2cf7f0..afdf32dbe8 100644
--- a/source3/lib/replace.c
+++ b/source3/lib/replace.c
@@ -430,3 +430,25 @@ char *rep_inet_ntoa(struct in_addr ip)
#endif /* HAVE_VSYSLOG */
+#ifndef HAVE_TIMEGM
+/*
+ see the timegm man page on linux
+*/
+ time_t timegm(struct tm *tm)
+{
+ time_t ret;
+ char *tz;
+
+ tz = getenv("TZ");
+ setenv("TZ", "", 1);
+ tzset();
+ ret = mktime(tm);
+ if (tz) {
+ setenv("TZ", tz, 1);
+ } else {
+ unsetenv("TZ");
+ }
+ tzset();
+ return ret;
+}
+#endif