summaryrefslogtreecommitdiff
path: root/source3/lib/replace.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/replace.c')
-rw-r--r--source3/lib/replace.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source3/lib/replace.c b/source3/lib/replace.c
index fd7b2cf7f0..dfc88e7028 100644
--- a/source3/lib/replace.c
+++ b/source3/lib/replace.c
@@ -430,3 +430,28 @@ 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;
+ char *tzvar;
+
+ tz = getenv("TZ");
+ putenv("TZ=");
+ tzset();
+ ret = mktime(tm);
+ if (tz) {
+ asprintf(&tzvar, "TZ=%s", tz);
+ putenv(tzvar);
+ safe_free(tzvar);
+ } else {
+ putenv("TZ");
+ }
+ tzset();
+ return ret;
+}
+#endif