From: Michael G Schwern Date: Sun, 14 Sep 2008 21:50:38 +0000 (-0700) Subject: Update from y2038. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7bda3dfccb26dc3c52669a7451b220893a99a1be;p=p5sagit%2Fp5-mst-13.2.git Update from y2038. Fix the logic when to use the system functions to include the min check. -2147483648 was throwing a warning. -2147483647 does not. --- diff --git a/localtime64.c b/localtime64.c index 13abdec..b9f60e9 100644 --- a/localtime64.c +++ b/localtime64.c @@ -89,8 +89,16 @@ static const int dow_year_start[28] = { #define IS_LEAP(n) ((!(((n) + 1900) % 400) || (!(((n) + 1900) % 4) && (((n) + 1900) % 100))) != 0) #define WRAP(a,b,m) ((a) = ((a) < 0 ) ? ((b)--, (a) + (m)) : (a)) -#define SHOULD_USE_SYSTEM_LOCALTIME(a) ( USE_SYSTEM_LOCALTIME && (a) <= SYSTEM_LOCALTIME_MAX ) -#define SHOULD_USE_SYSTEM_GMTIME(a) ( USE_SYSTEM_GMTIME && (a) <= SYSTEM_GMTIME_MAX ) +#define SHOULD_USE_SYSTEM_LOCALTIME(a) ( \ + USE_SYSTEM_LOCALTIME && \ + (a) <= SYSTEM_LOCALTIME_MAX && \ + (a) >= SYSTEM_LOCALTIME_MIN \ +) +#define SHOULD_USE_SYSTEM_GMTIME(a) ( \ + USE_SYSTEM_GMTIME && \ + (a) <= SYSTEM_GMTIME_MAX && \ + (a) >= SYSTEM_GMTIME_MIN \ +) int _is_exception_century(Int64 year) diff --git a/localtime64.h b/localtime64.h index d676c28..078be13 100644 --- a/localtime64.h +++ b/localtime64.h @@ -1,5 +1,3 @@ -#include - #ifndef LOCALTIME64_H # define LOCALTIME64_H @@ -26,8 +24,8 @@ USE_SYSTEM_GMTIME Should we use the system functions if the time is inside their range? */ -#define SYSTEM_LOCALTIME_MAX 2147483647 /* XXX Replace with LOCALTIME_MAX */ -#define SYSTEM_LOCALTIME_MIN -2147483648 /* XXX Replace with LOCALTIME_MIN */ +#define SYSTEM_LOCALTIME_MAX 2147483647 /* XXX Replace with LOCALTIME_MAX */ +#define SYSTEM_LOCALTIME_MIN -2147483647 /* XXX Replace with LOCALTIME_MIN */ #define SYSTEM_GMTIME_MAX GMTIME_MAX #define SYSTEM_GMTIME_MIN GMTIME_MIN