From owner-p4-projects Mon Aug 26 19:20:45 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1355937B401; Mon, 26 Aug 2002 19:20:41 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B81A737B400 for ; Mon, 26 Aug 2002 19:20:40 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 71CA943E65 for ; Mon, 26 Aug 2002 19:20:40 -0700 (PDT) (envelope-from peter@freebsd.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g7R2KeJU075760 for ; Mon, 26 Aug 2002 19:20:40 -0700 (PDT) (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g7R2KeaU075757 for perforce@freebsd.org; Mon, 26 Aug 2002 19:20:40 -0700 (PDT) Date: Mon, 26 Aug 2002 19:20:40 -0700 (PDT) Message-Id: <200208270220.g7R2KeaU075757@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm Subject: PERFORCE change 16624 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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