From gami@moonshine.s.notwork.org  Sat Jan 12 11:16:35 2008
Return-Path: <gami@moonshine.s.notwork.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2F4CB16A420
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 12 Jan 2008 11:16:35 +0000 (UTC)
	(envelope-from gami@moonshine.s.notwork.org)
Received: from moonshine.s.notwork.org (unknown [IPv6:2001:380:e04:3d:21c:c4ff:fedb:4f9a])
	by mx1.freebsd.org (Postfix) with ESMTP id A249D13C47E
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 12 Jan 2008 11:16:34 +0000 (UTC)
	(envelope-from gami@moonshine.s.notwork.org)
Received: from moonshine.s.notwork.org (localhost [127.0.0.1])
	by moonshine.s.notwork.org (8.14.2/8.14.2) with ESMTP id m0CBGXKN002284
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 12 Jan 2008 20:16:33 +0900 (JST)
	(envelope-from gami@moonshine.s.notwork.org)
Received: (from gami@localhost)
	by moonshine.s.notwork.org (8.14.2/8.14.2/Submit) id m0CBGXfN002283;
	Sat, 12 Jan 2008 20:16:33 +0900 (JST)
	(envelope-from gami@moonshine.s.notwork.org)
Message-Id: <864pdjxpim.fsf@moonshine.s.notwork.org>
Date: Sat, 12 Jan 2008 20:16:33 +0900
From: IKEGAMI Akiko <gami@moonshine.s.notwork.org>
Reply-To: IKEGAMI Akiko <gami@moonshine.s.notnotwork.org>
To: FreeBSD-gnats-submit@freebsd.org
Subject: time_t on 64-bit architecture

>Number:         119591
>Category:       amd64
>Synopsis:       [amd64] [patch] time_t on 64-bit architecture
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-amd64
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 12 11:20:00 UTC 2008
>Closed-Date:    Sun Dec 05 10:42:36 UTC 2010
>Last-Modified:  Sun Dec 05 10:42:36 UTC 2010
>Originator:     IKEGAMI Akiko
>Release:        FreeBSD 6.3-PRERELEASE i386
>Organization:
CBUG
>Environment:
System: FreeBSD moonshine.s.notwork.org 6.3-PRERELEASE FreeBSD 6.3-PRERELEASE #2: Thu Dec 20 14:15:45 JST 2007 root@moonshine.s.notwork.org:/usr/obj/usr/src/sys/GENERIC i386
>Description:
	amd64's time_t is 64-bit, but comment at clock.c is
		32-bit time_t's can't reach leap years before 1904 or after 2036
>How-To-Repeat:
	You should ride time machine, and you can enjoy "Twilight zone".
>Fix:
	
--- sys/amd64/isa/clock.orig	2008-01-10 21:38:55.000000000 +0900
+++ sys/amd64/isa/clock.c	2008-01-12 19:38:37.000000000 +0900
@@ -82,11 +82,7 @@
 #include <isa/isavar.h>
 #endif
 
-/*
- * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we
- * can use a simple formula for leap years.
- */
-#define	LEAPYEAR(y) (((u_int)(y) % 4 == 0) ? 1 : 0)
+#define	LEAPYEAR(y) (((u_int)(y) % 400 == 0) ? 1 : ((u_int)(y) % 100 != 0 && (u_int)(y) % 4 == 0) ? 1 : 0)
 #define DAYSPERYEAR   (31+28+31+30+31+30+31+31+30+31+30+31)
 
 #define	TIMER_DIV(x) ((timer_freq + (x) / 2) / (x))

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->freebsd-amd64 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sat Jan 12 14:35:02 UTC 2008 
Responsible-Changed-Why:  
Reclassify. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=119591 

From: Peter Jeremy <peterjeremy@optushome.com.au>
To: IKEGAMI Akiko <gami@moonshine.s.notwork.org>
Cc: bug-followup@freebsd.org
Subject: Re: amd64/119591: [amd64] [patch] time_t on 64-bit architecture
Date: Sun, 13 Jan 2008 07:50:31 +1100

 --VuQYccsttdhdIfIP
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 Whilst I agree that the existing LEAPYEAR macro can only handle
 dates between 1901 and 2099, this macro is only used to convert
 timestamps to/from the RTC - and currently that code will only
 support dates between 1970 and 2069.  There is provision to
 separately store the century in the RTC but this code is not
 currently active.
 
 Note that the code to write the time back to the RTC currently
 steps year-by-year and is therefore also needs a rethink before
 the range is massively increased.
 
 --=20
 Peter Jeremy
 
 --VuQYccsttdhdIfIP
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.4 (FreeBSD)
 
 iD8DBQFHiSgX/opHv/APuIcRAvlSAJ0ToZ3alNx0ZQToWtqr1w3NszmvuwCferLU
 g8VCxtobSdYLszr3QO7KM9Y=
 =pnIr
 -----END PGP SIGNATURE-----
 
 --VuQYccsttdhdIfIP--
State-Changed-From-To: open->closed 
State-Changed-By: avg 
State-Changed-When: Sun Dec 5 10:41:10 UTC 2010 
State-Changed-Why:  
Let's reopen this PR somewhen closer to year 2100 
if x86 architecture and RTC are still around then. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=119591 
>Unformatted:
 >Drinking with: ume, motoyuki, sarumaru
 
 
 -- 
 $B$$$1$,$_$"$-$3(B
