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

metze at samba.org metze at samba.org
Thu Dec 22 11:13:06 GMT 2005


Author: metze
Date: 2005-12-22 11:13:05 +0000 (Thu, 22 Dec 2005)
New Revision: 12431

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=12431

Log:
- the TIME_T_MAX needs to be a singed max value
- fix the calculation of TIME_T_MAX -> nttime -> TIME_T_MAX

metze
Modified:
   branches/SAMBA_4_0/source/lib/time.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/time.c
===================================================================
--- branches/SAMBA_4_0/source/lib/time.c	2005-12-22 09:58:51 UTC (rev 12430)
+++ branches/SAMBA_4_0/source/lib/time.c	2005-12-22 11:13:05 UTC (rev 12431)
@@ -23,13 +23,26 @@
 #include "includes.h"
 #include "system/time.h"
 
+#ifndef CHAR_BIT
+# define CHAR_BIT 8
+#endif
+
+/* The extra casts work around common compiler bugs.  */
+#define _TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
+   It is necessary at least when t == time_t.  */
+#define _TYPE_MINIMUM(t) ((t) (_TYPE_SIGNED (t) \
+  			      ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
+#define _TYPE_MAXIMUM(t) ((t) (~ (t) 0 - _TYPE_MINIMUM (t)))
+			      
 #ifndef TIME_T_MIN
 #define TIME_T_MIN 0
 #endif
 #ifndef TIME_T_MAX
-#define TIME_T_MAX (~(time_t)0)
+#define TIME_T_MAX _TYPE_MAXIMUM (time_t)
 #endif
-
+			      
+			      
 /*******************************************************************
  External access to time_t_min and time_t_max.
 ********************************************************************/
@@ -69,7 +82,7 @@
 	nt /= 1000*1000*10;
 	nt -= TIME_FIXUP_CONSTANT;
 
-	if (TIME_T_MIN >= nt || nt >= TIME_T_MAX) {
+	if (TIME_T_MIN > nt || nt > TIME_T_MAX) {
 		return 0;
 	}
 



More information about the samba-cvs mailing list