summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-09-04 13:35:03 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:17:07 -0500
commitcb962c93737e8d0facdcd26461aaea5062a3b21d (patch)
tree6fc223dfe7588dc0cac138c47346abca481492b8 /source4/lib
parent73493a095ae4802cd3e1222b22321454db17b988 (diff)
downloadsamba-cb962c93737e8d0facdcd26461aaea5062a3b21d.tar.gz
samba-cb962c93737e8d0facdcd26461aaea5062a3b21d.tar.bz2
samba-cb962c93737e8d0facdcd26461aaea5062a3b21d.zip
r18044: timegm.c needs to be in a separate file
(This used to be commit 3ec1db7bd12cdc233c37f261073a33fc48ecd7ce)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/replace/Makefile.in2
-rw-r--r--source4/lib/replace/replace.c33
-rw-r--r--source4/lib/replace/timegm.c4
3 files changed, 4 insertions, 35 deletions
diff --git a/source4/lib/replace/Makefile.in b/source4/lib/replace/Makefile.in
index 1880a122dd..1dbc94341b 100644
--- a/source4/lib/replace/Makefile.in
+++ b/source4/lib/replace/Makefile.in
@@ -11,7 +11,7 @@ INSTALL = @INSTALL@
CFLAGS=-I. -I$(srcdir) @CFLAGS@
-OBJS = dlfcn.o getpass.o replace.o snprintf.o
+OBJS = dlfcn.o getpass.o replace.o snprintf.o timegm.o
all: libreplace.a testsuite
diff --git a/source4/lib/replace/replace.c b/source4/lib/replace/replace.c
index 1c05c14eb6..7bfdc3d640 100644
--- a/source4/lib/replace/replace.c
+++ b/source4/lib/replace/replace.c
@@ -468,7 +468,7 @@ char *rep_mkdtemp(char *template)
{
char *dname;
- if (dname = mktemp(template)) {
+ if ((dname = mktemp(template))) {
if (mkdir(dname, 0700) >= 0) {
return dname;
}
@@ -603,34 +603,3 @@ int rep_setenv(const char *name, const char *value, int overwrite)
}
#endif
-#if !defined(HAVE_TIMEGM)
-
-static int is_leap(unsigned y)
-{
- y += 1900;
- return (y % 4) == 0 && ((y % 100) != 0 || (y % 400) == 0);
-}
-
-time_t timegm(struct tm *tm)
-{
- static const unsigned ndays[2][12] ={
- {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
- {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}};
- time_t res = 0;
- unsigned i;
-
- for (i = 70; i < tm->tm_year; ++i)
- res += is_leap(i) ? 366 : 365;
-
- for (i = 0; i < tm->tm_mon; ++i)
- res += ndays[is_leap(tm->tm_year)][i];
- res += tm->tm_mday - 1;
- res *= 24;
- res += tm->tm_hour;
- res *= 60;
- res += tm->tm_min;
- res *= 60;
- res += tm->tm_sec;
- return res;
-}
-#endif
diff --git a/source4/lib/replace/timegm.c b/source4/lib/replace/timegm.c
index 5fb15475f3..1c9a0e4165 100644
--- a/source4/lib/replace/timegm.c
+++ b/source4/lib/replace/timegm.c
@@ -35,8 +35,8 @@
adapted for Samba4 by Andrew Tridgell
*/
-#include "includes.h"
-#include "ldb/include/includes.h"
+#include "replace.h"
+#include <stdlib.h>
#ifndef HAVE_TIMEGM