Subject: port-i386/26152: [PATCH] clock is out of sync on non-SMP machine
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <fun@naobsd.org>
List: netbsd-bugs
Date: 07/04/2004 02:43:54
>Number:         26152
>Category:       port-i386
>Synopsis:       [PATCH] clock is out of sync on non-SMP machine
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 03 18:07:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     FUKAUMI Naoki
>Release:        NetBSD 2.0G
>Organization:
	FUKAUMI Naoki
>Environment:
System: NetBSD eden.naobsd.org 2.0G NetBSD 2.0G (EDEN) #1: Sun Jul 4 02:21:07 JST 2004 fun@ea65.naobsd.org:/home/fun/EDEN i386
Architecture: i386
Machine: i386
>Description:
	src/sys/arch/i386/isa/clock.c rev. 1.83 is broken.

	eden# ntpdate ntp-tk01.ocn.ad.jp && sleep 60 && ntpdate ntp-tk01.ocn.ad.jp
 	4 Jul 00:54:23 ntpdate[733]: step time server 202.234.233.106 offset 0.761195 sec
 	4 Jul 00:55:22 ntpdate[671]: step time server 202.234.233.106 offset 2.260415 sec

	The time was leaped 2.26 sec. in 60 sec. ;)
>How-To-Repeat:
	See above.
>Fix:
Index: clock.c
===================================================================
RCS file: /home/fun/cvsroot/NetBSD/src/sys/arch/i386/isa/clock.c,v
retrieving revision 1.83
diff -u -r1.83 clock.c
--- clock.c	1 Jul 2004 13:00:39 -0000	1.83
+++ clock.c	3 Jul 2004 17:20:55 -0000
@@ -612,7 +612,7 @@
 	 * we'll actually get (TIMER_FREQ/rtclock_tval) interrupts/sec.
 	 */
 	fixtick = 1000000 -
-	    (tick * TIMER_FREQ + rtclock_tval / 2) / rtclock_tval;
+	    ((int64_t)tick * TIMER_FREQ + rtclock_tval / 2) / rtclock_tval;
 #endif /* NTP */
 
 	/*
>Release-Note:
>Audit-Trail:
>Unformatted: