From owner-freebsd-questions@FreeBSD.ORG Mon Jul 14 20:16:17 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A2FFE37B401 for ; Mon, 14 Jul 2003 20:16:17 -0700 (PDT) Received: from grumpy.dyndns.org (user-24-214-34-52.knology.net [24.214.34.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9A5B843F3F for ; Mon, 14 Jul 2003 20:16:16 -0700 (PDT) (envelope-from dkelly@grumpy.dyndns.org) Received: from grumpy.dyndns.org (localhost [127.0.0.1]) by grumpy.dyndns.org (8.12.9/8.12.9) with ESMTP id h6F3GFDh061217 for ; Mon, 14 Jul 2003 22:16:15 -0500 (CDT) (envelope-from dkelly@grumpy.dyndns.org) Received: by grumpy.dyndns.org (8.12.9/8.12.9/Submit) id h6F3GF38061216 for FreeBSD-Questions@FreeBSD.org; Mon, 14 Jul 2003 22:16:15 -0500 (CDT) From: David Kelly To: FreeBSD-Questions@FreeBSD.org Date: Mon, 14 Jul 2003 22:16:10 -0500 User-Agent: KMail/1.5.2 References: <20030714231604.GA27924@teddy.fas.com> <5.1.0.14.2.20030714201034.00a742b0@209.152.117.178> In-Reply-To: <5.1.0.14.2.20030714201034.00a742b0@209.152.117.178> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200307142216.10191.dkelly@HiWAAY.net> Subject: Re: Seting the hardware clock X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jul 2003 03:16:17 -0000 On Monday 14 July 2003 08:11 pm, W. D. wrote: > At 19:24 7/14/2003, David Kelly, wrote: > >Another thing we saw with Soekris and FreeBSD 4.x was that FreeBSD > > wrote Sunday as 0 but would accept 0 or 7 on read, Soekris clock > > hardware was happy with 0, but BIOS demanded 7 else it assumed the > > clock was corrupt and reset its time to Jan 1, 1980. This only > > mattered if you rebooted on Sunday. Its a 2 byte patch to FreeBSD > > 4.x, already included in 5.x. > > Where would one find this 2 byte patch for 4.7? Look for messages from phk in the soekris-tech mail list archives at http://www.soekris.com/ to be sure of finding the right thing. Nosing around a bit I believe the file is /usr/src/sys/i386/isa/clock.c. The fixed version (copied from 5.1): writertc(RTC_WDAY, (tm + 4) % 7 + 1); /* Write back Weekday */ The old version ("+ 1" hacked out of above): writertc(RTC_WDAY, (tm + 4) % 7 ); /* Write back Weekday */ % cvs log /usr/src/sys/i386/isa/clock.c says: revision 1.191 date: 2002/12/04 13:46:49; author: phk; state: Exp; lines: +1 -1 Use the correct value when writing the Day Of Week byte in the CMOS. The correct range is [1...7] with Sunday=1, but we have been writing [0...6] with Sunday=0. The Soekris computers flagged the zero, zapped the date, so if you rebooted your soekris on a sunday, it would come up with a wrong date. Bruce has a more extensive rework of this code, but we will stick with the minimalist fix for now. Spotted by: Soren Kristensen Thanks to: Michael Sierchio . Confirmed by: bde Approved by: re IIRC the comment above about Sunday is incorrect. Have been using 0, but 7 (not 1) is correct. I believe 1-6 is still Monday thru Saturday in both versions. But I'm not going to sweat it tonight. Both versions work on most BIOS's. -- David Kelly N4HHE, dkelly@hiwaay.net ===================================================================== The human mind ordinarily operates at only ten percent of its capacity -- the rest is overhead for the operating system.