svn commit: samba r3223 - in branches/SAMBA_4_0/source/lib: .

tridge at samba.org tridge at samba.org
Mon Oct 25 23:26:13 GMT 2004


Author: tridge
Date: 2004-10-25 23:26:13 +0000 (Mon, 25 Oct 2004)
New Revision: 3223

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/lib&rev=3223&nolog=1

Log:
continue the effort on LIBREPLACE to try to get the ldb tools to
compile on platforms like solaris without having to link to the whole
of the Samba4 lib directory.

Modified:
   branches/SAMBA_4_0/source/lib/basic.mk
   branches/SAMBA_4_0/source/lib/replace.c
   branches/SAMBA_4_0/source/lib/time.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/basic.mk
===================================================================
--- branches/SAMBA_4_0/source/lib/basic.mk	2004-10-25 21:00:00 UTC (rev 3222)
+++ branches/SAMBA_4_0/source/lib/basic.mk	2004-10-25 23:26:13 UTC (rev 3223)
@@ -4,6 +4,8 @@
 # Start SUBSYSTEM LIBREPLACE
 [SUBSYSTEM::LIBREPLACE]
 INIT_OBJ_FILES = lib/replace.o
+ADD_OBJ_FILES = \
+		lib/snprintf.o
 # End SUBSYSTEM LIBREPLACE
 ##############################
 
@@ -23,7 +25,6 @@
 		lib/time.o \
 		lib/genrand.o \
 		lib/username.o \
-		lib/snprintf.o \
 		lib/dprintf.o \
 		lib/xfile.o \
 		lib/wins_srv.o \

Modified: branches/SAMBA_4_0/source/lib/replace.c
===================================================================
--- branches/SAMBA_4_0/source/lib/replace.c	2004-10-25 21:00:00 UTC (rev 3222)
+++ branches/SAMBA_4_0/source/lib/replace.c	2004-10-25 23:26:13 UTC (rev 3223)
@@ -427,7 +427,40 @@
 #endif /* HAVE_SYSLOG */
 #endif /* HAVE_VSYSLOG */
 
+/*******************************************************************
+yield the difference between *A and *B, in seconds, ignoring leap seconds
+********************************************************************/
+static int tm_diff(struct tm *a, struct tm *b)
+{
+	int ay = a->tm_year + (1900 - 1);
+	int by = b->tm_year + (1900 - 1);
+	int intervening_leap_days =
+		(ay/4 - by/4) - (ay/100 - by/100) + (ay/400 - by/400);
+	int years = ay - by;
+	int days = 365*years + intervening_leap_days + (a->tm_yday - b->tm_yday);
+	int hours = 24*days + (a->tm_hour - b->tm_hour);
+	int minutes = 60*hours + (a->tm_min - b->tm_min);
+	int seconds = 60*minutes + (a->tm_sec - b->tm_sec);
 
+	return seconds;
+}
+
+/*******************************************************************
+  return the UTC offset in seconds west of UTC, or 0 if it cannot be determined
+  ******************************************************************/
+int get_time_zone(time_t t)
+{
+	struct tm *tm = gmtime(&t);
+	struct tm tm_utc;
+	if (!tm)
+		return 0;
+	tm_utc = *tm;
+	tm = localtime(&t);
+	if (!tm)
+		return 0;
+	return tm_diff(&tm_utc,tm);
+}
+
 #ifndef HAVE_TIMEGM
 /*
   yes, I know this looks insane, but its really needed. The function in the 

Modified: branches/SAMBA_4_0/source/lib/time.c
===================================================================
--- branches/SAMBA_4_0/source/lib/time.c	2004-10-25 21:00:00 UTC (rev 3222)
+++ branches/SAMBA_4_0/source/lib/time.c	2004-10-25 23:26:13 UTC (rev 3223)
@@ -49,40 +49,7 @@
 #endif
 }
 
-/*******************************************************************
-yield the difference between *A and *B, in seconds, ignoring leap seconds
-********************************************************************/
-static int tm_diff(struct tm *a, struct tm *b)
-{
-	int ay = a->tm_year + (1900 - 1);
-	int by = b->tm_year + (1900 - 1);
-	int intervening_leap_days =
-		(ay/4 - by/4) - (ay/100 - by/100) + (ay/400 - by/400);
-	int years = ay - by;
-	int days = 365*years + intervening_leap_days + (a->tm_yday - b->tm_yday);
-	int hours = 24*days + (a->tm_hour - b->tm_hour);
-	int minutes = 60*hours + (a->tm_min - b->tm_min);
-	int seconds = 60*minutes + (a->tm_sec - b->tm_sec);
 
-	return seconds;
-}
-
-/*******************************************************************
-  return the UTC offset in seconds west of UTC, or 0 if it cannot be determined
-  ******************************************************************/
-int get_time_zone(time_t t)
-{
-	struct tm *tm = gmtime(&t);
-	struct tm tm_utc;
-	if (!tm)
-		return 0;
-	tm_utc = *tm;
-	tm = localtime(&t);
-	if (!tm)
-		return 0;
-	return tm_diff(&tm_utc,tm);
-}
-
 #define TIME_FIXUP_CONSTANT 11644473600LL
 
 /****************************************************************************



More information about the samba-cvs mailing list