Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Aug 2002 19:20:40 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 16624 for review
Message-ID:  <200208270220.g7R2KeaU075757@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=16624

Change 16624 by peter@peter_mckinley on 2002/08/26 19:20:04

	I do not believe this.  The algorithm goes into high orbit if
	time_t is 64 bit while it tries to iteratively figure out things
	like whether the year with time_t 2^62 is a leap year or not.
	If sizeof(time_t) is > 32 bit, use the 32nd bit as the center of the
	search.  Otherwise, the various other while() loops will still be
	running when the 32 bit time_t clocks over.

Affected files ...

.. //depot/projects/ia64/lib/libc/stdtime/localtime.c#5 edit

Differences ...

==== //depot/projects/ia64/lib/libc/stdtime/localtime.c#5 (text+ko) ====

@@ -1476,6 +1476,12 @@
 	*/
 	bits = TYPE_BIT(time_t) - 1;
 	/*
+	 * Limit to 32 bits or the things go crazy
+	 * when it tries to figure out times near 2^62 etc.
+	 */
+	if (bits > 31)
+		bits = 31;
+	/*
 	** If time_t is signed, then 0 is just above the median,
 	** assuming two's complement arithmetic.
 	** If time_t is unsigned, then (1 << bits) is just above the median.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208270220.g7R2KeaU075757>