Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Mar 2001 00:43:19 -0800 (PST)
From:      Matthew Jacob <mjacob@feral.com>
To:        Yoriaki FUJIMORI <fujimori@baron.fujimori.cache.waseda.ac.jp>
Cc:        freebsd-alpha@freebsd.org, Jordan Hubbard <jkh@bsdi.com>
Subject:   realtime clock problem solved
Message-ID:  <Pine.BSF.4.21.0103090040070.4175-100000@beppo.feral.com>
In-Reply-To: <200103051823.f25INdT38459@baron.fujimori.cache.waseda.ac.jp>

next in thread | previous in thread | raw e-mail | index | archive | help


On Mon, 5 Mar 2001, Yoriaki FUJIMORI wrote:

> 
> As for a realtime clock problem, it should persist on many alphapc164,
> pc164lx and up1100.  At least in my lab, they all suffer from this.
> It was a fun to see `Feb 29, 2000' on all of them. (;_;)
> 
> I guess FreeBSD/Alpha alone makes use of mcclock.c.  I could not find
> its counterpart in FreeBSD/i386.
> 
> Yoriaki Fujimori
> 

I think I have a fix for this- it fixed my problem. The problem here is that
the clock register was being written with a > 2 digit value. The below patch
could be simpler in that just the update of the regs value should come after
the rolloff to 2 digits.

Could you try this for your machines?

Jordan? If this pans out is this still possible to get into 4.3?

Index: sys/dev/dec/mcclock.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/dec/mcclock.c,v
retrieving revision 1.5
diff -u -r1.5 mcclock.c
--- sys/dev/dec/mcclock.c	2000/01/04 03:22:04	1.5
+++ sys/dev/dec/mcclock.c	2001/03/09 08:39:19
@@ -84,10 +84,7 @@
 	ct->day = regs[MC_DOM];
 	ct->mon = regs[MC_MONTH];
 	ct->year = regs[MC_YEAR];
-	/*
-	 * This chip is not y2k compliant, so we'll do a 10 year window fix.
-	 */
-	if (ct->year >= 0 && ct->year < 10) {
+	if (ct->year < 70) {
 		ct->year += 100;
 	}
 }
@@ -111,15 +108,7 @@
 	regs[MC_DOW] = ct->dow;
 	regs[MC_DOM] = ct->day;
 	regs[MC_MONTH] = ct->mon;
-	regs[MC_YEAR] = ct->year;
-	/*
-	 * This chip is not y2k compliant, so we'll do a 10 year window fix.
-	 * It's probably okay to write more than 100, but let's not and
-	 * and say we didn't.
-	 */
-	if (ct->year >= 100) {
-		ct->year -= 100;
-	}
+	regs[MC_YEAR] = ct->year % 100;
 	s = splclock();
 	MC146818_PUTTOD(dev, &regs);
 	splx(s);



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0103090040070.4175-100000>