Re: Reading the RTC



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
.



Relevant Pages

  • [PATCH 2/2] rtc: Add boot_timesource sysfs attribute
    ... CONFIG_RTC_HCTOSYS allows the kernel to read the system time from the RTC ... at boot and resume, avoiding the need for userspace to do so. ...
    (Linux-Kernel)
  • Reading the RTC
    ... systohw reads the current system time, then sleeps until the next whole second, then writes that date to the RTC. ... readrtc sets up the RTC to raise an IRQ at 1 Hz, then sits in a loop waiting for the IRQ, printing the system time every time the OS catches an IRQ. ...
    (comp.protocols.time.ntp)
  • Re: [rtc-linux] Re: [PATCH 2/2] rtc: Add boot_timesource sysfs attribute
    ... CONFIG_RTC_HCTOSYS allows the kernel to read the system time from the RTC ... avoiding the need for userspace to do so. ... Add a hctosys sysfs attribute which indicates whether a given RTC set ...
    (Linux-Kernel)
  • Re: Unable to change/set time in Fedora 9
    ... This tells the system to write the system time to the rtc (real time ... then this will write utc to the rtc. ... localtime (although there was a bug in some distros that they would ...
    (alt.os.linux)
  • Re: Setting The System Clock [Linux]
    ... but chrony also corrects for your rtc errors. ... >the rtc, subtract 28800 sec, and set your Linux system time to that. ... >it is on local time, and display that time. ...
    (comp.os.linux.misc)