diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-01-07 10:28:48 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:49:50 -0500 |
commit | ddf0e3d046c668a7cc7133bed45939187f3bd138 (patch) | |
tree | f76f90cf7a56385b59cc097610d28f42afbe5b8a /source4/lib | |
parent | caa913ead4c17ff775e6dd8db47ed48cde1421c2 (diff) | |
download | samba-ddf0e3d046c668a7cc7133bed45939187f3bd138.tar.gz samba-ddf0e3d046c668a7cc7133bed45939187f3bd138.tar.bz2 samba-ddf0e3d046c668a7cc7133bed45939187f3bd138.zip |
r12754: - sync TIME_T_MAX calculation from samba3
- but limit TIME_T_MAX to INT32_MAX, otherwise 64 platfroms are broken
because gmtime() will fail with INT64_MAX passed in!
I'm not sure if that's the best fix for this problem, but it works...
Should we port the INT32_MAX limitation to samba3?
Comments, please?
metze
(This used to be commit 396fa81be5b950aa2120cff19540a0236f79a685)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/time.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/source4/lib/time.c b/source4/lib/time.c index b8ef3d7724..65e9fc85cb 100644 --- a/source4/lib/time.c +++ b/source4/lib/time.c @@ -24,25 +24,17 @@ #include "system/time.h" #ifndef CHAR_BIT -# define CHAR_BIT 8 +#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 +#define TIME_T_MIN ((time_t)0 < (time_t) -1 ? (time_t) 0 \ + : ~ (time_t) 0 << (sizeof (time_t) * CHAR_BIT - 1)) #endif #ifndef TIME_T_MAX -#define TIME_T_MAX _TYPE_MAXIMUM (time_t) +#define TIME_T_MAX MIN(INT32_MAX,(~ (time_t) 0 - TIME_T_MIN)) #endif - /******************************************************************* External access to time_t_min and time_t_max. ********************************************************************/ |