[ntp:questions] Reading the RTC
Serge Bets
serge.bets at NOSPAM.laposte.invalid
Fri Sep 28 14:09:34 UTC 2007
On Wednesday, September 26, 2007 at 15:51:49 +0200, Spoon wrote:
> CMOS_WRITE(save_control, RTC_CONTROL);
> CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
> Does the RTC reset when I write RTC_FREQ_SELECT?
The comments there indicate that the combination of negating RTC_SET and
RTC_DIV_RESET2 in that order restart the oscillator. So IIUC that's those
2 last writes, to RTC_CONTROL and RTC_FREQ_SELECT registers.
> I noticed the 500-ms error when I used util-linux-2.12q hwclock (which
> I thought at the time was the latest version).
That was an util-linux misfeature, fixed in ng-2.13
> STEP 1: Synchronize system clock within 50 ms
> STEP 2: Write the system time to the RTC
BTW some operations of hwclock can benefit from a system clock ticking
at the good frequency. At some level of wanted precision, it is better
to preset frequency via ntptime -f, adjtimex -f, ntpd, or whatever.
> Or it may have something to do with this:
> Recognize Linux rtc device bug where read() returns immediately
> instead of waiting for the update interrupt.
Not linked: that's another problem.
Serge.
--
Serge point Bets arobase laposte point net
More information about the questions
mailing list