rtc again...

Martin Costabel costabel at wanadoo.fr
Thu Aug 3 19:00:55 EST 2000


Iain Sandoe wrote:
>
> Hi,
>
> under 2.2.17pre15ben1
>
> rtc does not give me the right answer when built in - what am I doing wrong?
>
> It won't build load as a module right now 'cos I forgot to check ppc_ksyms
> before doing the build :-( .... (I remembered for 2.4.0).
>
> under 2.4.0-test5 it seems to be fine as a module (haven't tried built in).

I am using it as module both for 2.2.17-bk and for 2.4.0-test5. They
don't give the same time, and I think it is the one in 2.4.0 that is
right. I am at GMT+2:00, and the time in 2.2.17 is 2 hours early. When I
change /etc/sysconfig/clock from "UTC=false" to "UTC=true", both times
shift by 2 hours, but the discrepancy remains.

The following patch for bitkeeper linuxppc_2_2 fixes this problem for
me. It brings 2.2.17pre13 in line with 2.4.0-test5 (and MacOS). I cannot
test the VIAPMU part, so maybe there the offset is necessary, but for
the VIACUDA part, it seems wrong.

--
Martin
-------------- next part --------------
--- arch/ppc/kernel/pmac_time.c~	Mon Jun 26 09:09:05 2000
+++ arch/ppc/kernel/pmac_time.c	Thu Aug  3 09:22:36 2000
@@ -78,7 +78,6 @@
 unsigned long pmac_get_rtc_time(void)
 {
 	struct adb_request req;
-	int offset = sys_tz.tz_minuteswest * 60;

 	/* Get the time from the RTC */
 	if (adb_controller == 0)
@@ -95,7 +94,7 @@
 			printk(KERN_ERR "pmac_get_rtc_time: got %d byte reply\n",
 			       req.reply_len);
 		return (req.reply[3] << 24) + (req.reply[4] << 16)
-			+ (req.reply[5] << 8) + req.reply[6] - RTC_OFFSET + offset;
+			+ (req.reply[5] << 8) + req.reply[6] - RTC_OFFSET;
 	case ADB_VIAPMU:
 		if (pmu_request(&req, NULL, 1, PMU_READ_RTC) < 0) {
 			printk("pmac_read_rtc_time: pmu_request failed\n");
@@ -107,7 +106,7 @@
 			printk(KERN_ERR "pmac_get_rtc_time: got %d byte reply\n",
 			       req.reply_len);
 		return (req.reply[1] << 24) + (req.reply[2] << 16)
-			+ (req.reply[3] << 8) + req.reply[4] - RTC_OFFSET + offset;
+			+ (req.reply[3] << 8) + req.reply[4] - RTC_OFFSET;
 	default:
 		return 0;
 	}



More information about the Linuxppc-dev mailing list