[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#542275: hwclock should not try to calculate the drift if rtc time is invalid [was: Re: Bug#542275: kernel error message for #542275 + patch]



Package: util-linux
Version: 2.16.2-0

Le mercredi 03 février 2010 à 03:49 +0000, Ben Hutchings a écrit :
> On Wed, 2010-02-03 at 03:42 +0100, Benjamin Cama wrote:
> > But still, it would be usefull to be able to set the RTC for those with
> > still a bit of juice in their battery. So, this is not this bug but
> > another one (related to hwclock), if you agree with my analysis. I'll
> > fill another one soon, if so.
> 
> Right, the bug is in hwclock.

Actually, it may not be a bug ...
I similar bug was fixed in #478663.
After a small gdb session, I saw that the rtc is read because hwclock
maintains /etc/adjtime each time you set your rtc (either with --set or
--systohc). To do so, it first needs to read the rtc and compare the
result to the system time to calculate the drift. But it fails because
of an invalid time.

So, the correct command in this context would be (see #478663) :
# hwclock --systohc --noadjfile --utc

But it took me some hard time to find it ...

So, i am submitting a new bug report to util-linux asking for a check if
the rtc is set to some valid time before calculating the drift, and so
ignoring invalid reads (but still not ignoring the timezone
in /etc/adjtime). It would be fabulous for people having flaky rtc
battery and fighting their hardware clock ...

Thanks Ben for investigating this, and thanks to anyone who can help,
benjamin




Reply to: