Subject: port-macppc/10265: rtc_offset support on macppc
To: None <gnats-bugs@gnats.netbsd.org>
From: SUNAGAWA Keiki <kei_sun@ba2.so-net.ne.jp>
List: netbsd-bugs
Date: 06/02/2000 09:05:12
>Number:         10265
>Category:       port-macppc
>Synopsis:       Adding RTC_OFFSET to kernel config file has no effect on macppc.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-macppc-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 02 09:06:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     SUNAGAWA Keiki <kei_sun@ba2.so-net.ne.jp>
>Release:        2000-06-02
>Organization:
home
>Environment:
	
System: NetBSD mikan 1.4Y NetBSD 1.4Y (IBOOK) #10: Mon May 15 23:04:29 JST 2000 kei@:/var/NetBSD-current/src/sys/arch/macppc/compile/IBOOK macppc


>Description:
	macppc/clock.c takes no care of rtc_offset.
>How-To-Repeat:
	Adjust RTC in NetBSD, boot MacOS and check RTC, vice versa.
>Fix:
	Apply the following patch which was posted to
	port-powerpc-ja@jp.netbsd.org by you@nightbreak.org (Y. Takizawa).

	The article is available at the URL below (in Japanese, though).
	http://www.jp.netbsd.org/ja/JP/ml/port-powerpc-ja/200003/msg00067.html


Index: conf/GENERIC
===================================================================
RCS file: /a/rsync/netbsd.org/syssrc/sys/arch/macppc/conf/GENERIC,v
retrieving revision 1.66
diff -u -r1.66 GENERIC
--- GENERIC	2000/05/26 00:22:06	1.66
+++ GENERIC	2000/05/30 13:49:40
@@ -12,6 +12,8 @@
 # Standard system options
 #options 	UCONSOLE	# users can use TIOCCONS (for xconsole)
 #options 	INSECURE	# disable kernel security levels
+
+options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
 #options 	NTP		# NTP phase/frequency locked loop
 options 	KTRACE		# system call tracing via ktrace(1)
 
Index: macppc/clock.c
===================================================================
RCS file: /a/rsync/netbsd.org/syssrc/sys/arch/macppc/macppc/clock.c,v
retrieving revision 1.9
diff -u -r1.9 clock.c
--- clock.c	2000/01/19 02:52:19	1.9
+++ clock.c	2000/05/02 13:39:42
@@ -80,7 +80,7 @@
 		return;
 	}
 	clockinitted = 1;
-	time.tv_sec = rtc_time - DIFF19041970;
+	time.tv_sec = rtc_time - DIFF19041970 + rtc_offset * 60;
 
 	deltat = time.tv_sec - base;
 	if (deltat < 0)
@@ -104,7 +104,7 @@
 	u_int rtc_time;
 
 	if (clockinitted) {
-		rtc_time = time.tv_sec + DIFF19041970;
+		rtc_time = time.tv_sec + DIFF19041970 - rtc_offset * 60;
 		adb_set_date_time(rtc_time);
 	}
 #endif
>Release-Note:
>Audit-Trail:
>Unformatted: