Re: [chrony-dev] [PATCH] More reliable method of reading rtc for initial trim

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


On Wed, May 28, 2014 at 01:23:45PM +0200, Hattink, Tjalling [FINT] wrote:
> When chrony reads in the linux rtc for the first time to trim the
> system clock, it only reads it once. As it is possible that the rtc
> updates itself during the read operation, the reported rtc time
> could be false. To prevent this I've added a loop that reads the rtc
> clock twice, if the seconds do not match retry the two read
> operations. If they match you can assume the read operation was
> successful.

Interesting, but I'm not sure I understand this correctly.

Are you saying that the RTC reading can be hh:mm:00 instead of
hh:mm+1:00 when the minute rolls over after hh:mm:59? How do we know
seconds are updated in RTC before minutes and that we can use the
first reading from two consecutive readings if they agree in seconds?
Isn't it possible that the two readings will be hh:mm:00 and
hh:mm+1:00 and we should use the second one?

> This is based on the hwclock implementation of reading the rtc clock
> from the util-linux package.

I don't see this in the current util-linux hwclock code. There is a
busy loop around ioctl(RTC_RD_TIME) to make the system clock reading
at the start of the RTC second, but it doesn't seem to be related to
the problem you describe, or is it?

-- 
Miroslav Lichvar

-- 
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/