added a timegm() function for systems that don't have it
authorAndrew Tridgell <tridge@samba.org>
Wed, 30 Oct 2002 12:03:40 +0000 (12:03 +0000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 30 Oct 2002 12:03:40 +0000 (12:03 +0000)
source/configure.in
source/include/includes.h
source/lib/replace.c

index 206a9edb50b260372138573131f4959b61ef0380..78ed4a953cf582a2218f0398f6f45e7a4ec7b526 100644 (file)
@@ -749,7 +749,7 @@ AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate
 AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64)
 AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf)
 AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
-AC_CHECK_FUNCS(syslog vsyslog getgrouplist)
+AC_CHECK_FUNCS(syslog vsyslog getgrouplist timegm)
 # setbuffer is needed for smbtorture
 AC_CHECK_FUNCS(setbuffer)
 
index 01b9f14979de616c33c18e1bce5c026b0528a473..a7dd967bf3456cafae1ec426f25fbf895f198e40 100644 (file)
@@ -1165,5 +1165,9 @@ int asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3);
 #define VA_COPY(dest, src) (dest) = (src)
 #endif
 
+#ifndef HAVE_TIMEGM
+time_t timegm(struct tm *tm);
+#endif
+
 #endif /* _INCLUDES_H */
 
index fd7b2cf7f016cb27ee8da91e5111ad98fa9903d1..afdf32dbe88dc59a60d81dc834935c3462d561bc 100644 (file)
@@ -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