This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH [4/n]: Support 64bit time_t and 32bit long


On Thu, Mar 15, 2012 at 12:52 PM, Roland McGrath <roland@hack.frob.com> wrote:
>> Linux/x32 uses 64bit time_t and 32bit long. ?This patch updates
>> ydhms_diff to support TIME_T_MAX != LONG_MAX. ?It also updates __offtime
>> to propeyly check overflow when converting time_t to long.
>
> These are two separate changes. ?The mktime change can go in no problem.
> The offtime change needs more consideration.
>
>
> Thanks,
> Roland

Here is the mktime patch.

-- 
H.J.
---
2012-03-15  H.J. Lu  <hongjiu.lu@intel.com>

	* time/mktime.c (ydhms_diff): Check TIME_T_MAX instead of
	LONG_MAX.
2012-03-15  H.J. Lu  <hongjiu.lu@intel.com>
 
	* time/mktime.c (ydhms_diff): Check TIME_T_MAX instead of
	LONG_MAX.

diff --git a/time/mktime.c b/time/mktime.c
index 683d468..e96cc48 100644
--- a/time/mktime.c
+++ b/time/mktime.c
@@ -168,7 +168,7 @@ ydhms_diff (long int year1, long int yday1, int hour1, int min1, int sec1,
 {
   verify (C99_integer_division, -1 / 2 == 0);
   verify (long_int_year_and_yday_are_wide_enough,
-	  INT_MAX <= LONG_MAX / 2 || TIME_T_MAX <= UINT_MAX);
+	  INT_MAX <= TIME_T_MAX / 2 || TIME_T_MAX <= UINT_MAX);
 
   /* Compute intervening leap days correctly even if year is negative.
      Take care to avoid integer overflow here.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]