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]

2010-05-21 Thread Mark Purcell
On Wednesday 03 February 2010 15:43:29 Benjamin Cama wrote:
 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 ...

Benjamin  Ben,

Thanks for this.

I was having the same issue with a ibook G4, that I couldn't get to boot and 
couldn't set the time past 1970, due to the flat battery.

--noadjfile fixed things up for me, so I could reboot with a sensible time.

Mark


signature.asc
Description: This is a digitally signed message part.


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]

2010-02-02 Thread Benjamin Cama
Package: util-linux
Version: 2.16.2-0

Le mercredi 03 février 2010 à 03:49 +, 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




--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org