From: Chris Davies on
Ă€ngel CatalĂ  <ninguna(a)null.org> wrote:
> I have tryed what you said, and when I typed "hwclock --show" I have got
> that message, and for "hwclock --show --directisa" it has worked, so I
> hacked /etc/default/rcS, but it still is failing.

This is the underlying problem. Your OS can't read or set the clock
correctly, so it can't correct for the two hours.

All the NTP suggestions are quite likely just side issues, sadly, and for
now I would strongly suggest you first address the underlying problem.
Once that's done, NTP should just start working as you'd expect.


To get the boot time sorted, you need to fiddle around with the hwclock
command. My assumptions are (a) that you're two hours ahead of UTC, and
(b) that your BIOS clock is running under local time rather than UTC.

1. Boot debian and set the time (using ntpdate, or whatever you prefer)
to within a couple of second or so of "real" time.

2. Write the current date/time to the BIOS clock:

hwclock --directisa --localtime --systohc --noadjfile

3. Remove the adjtime file, to reset any wild (and invalid) adjustment
attempts the system may have made:

rm -f /etc/adjtime

4. Write the current date/tiem to the BIOS clock again, this time
updating/creating the adjustment file:

hwclock --directisa --localtime --systohc

5. Verify the current date/time in the BIOS clock. This should show the
correct current time (to within a few seconds):

hwclock --directisa --show

If this doesn't show the right time, repeat from #3 again but
with --utc instead of --localtime for item #4

6. Reboot without updating the BIOS clock again:

reboot -f


That should work :-)
Chris
From: Àngel Català on
Chris Davies escribiĂł:
> Àngel Català <ninguna(a)null.org> wrote:
>> I have tryed what you said, and when I typed "hwclock --show" I have got
>> that message, and for "hwclock --show --directisa" it has worked, so I
>> hacked /etc/default/rcS, but it still is failing.
>
> This is the underlying problem. Your OS can't read or set the clock
> correctly, so it can't correct for the two hours.
>
> All the NTP suggestions are quite likely just side issues, sadly, and for
> now I would strongly suggest you first address the underlying problem.
> Once that's done, NTP should just start working as you'd expect.
>
>
> To get the boot time sorted, you need to fiddle around with the hwclock
> command. My assumptions are (a) that you're two hours ahead of UTC, and
> (b) that your BIOS clock is running under local time rather than UTC.
>
> 1. Boot debian and set the time (using ntpdate, or whatever you prefer)
> to within a couple of second or so of "real" time.
>
> 2. Write the current date/time to the BIOS clock:
>
> hwclock --directisa --localtime --systohc --noadjfile
>
> 3. Remove the adjtime file, to reset any wild (and invalid) adjustment
> attempts the system may have made:
>
> rm -f /etc/adjtime
>
> 4. Write the current date/tiem to the BIOS clock again, this time
> updating/creating the adjustment file:
>
> hwclock --directisa --localtime --systohc
>
> 5. Verify the current date/time in the BIOS clock. This should show the
> correct current time (to within a few seconds):
>
> hwclock --directisa --show
>
> If this doesn't show the right time, repeat from #3 again but
> with --utc instead of --localtime for item #4
>
> 6. Reboot without updating the BIOS clock again:
>
> reboot -f
>
>
> That should work :-)
> Chris

I have tried it with --utc instead --localtime and /etc/default/rcS with
UTC=yes

It seems it works, but... I have always 2 hour of difference between
Windows and Linux. If I have Linux with the right time, then Windows is
2 hour behind. If I adjust Windows then Linux is 2 hour in advance.

I will spend a bit time with this issue later.

Thanks.
From: Chris Davies on
Ă€ngel CatalĂ  <ninguna(a)null.org> wrote:
> I have tried it with --utc instead --localtime and /etc/default/rcS with
> UTC=yes

That's wrong. You DEFINITELY need UTC=no because your BIOS clock is set
by Windows to local time.

> It seems it works, but... I have always 2 hour of difference between
> Windows and Linux.

Then it's not working!

With the BIOS clock having been set to the correct time by Windows,
can you then tell us the output of these at Linux boot time, please:

date
date -u
hwclock --directisa --show --noadjtime --localtime
hwclock --directisa --show --noadjtime --utc

Thanks,
Chris
From: Àngel Català on
Chris Davies escribiĂł:
> Àngel Català <ninguna(a)null.org> wrote:
>> I have tried it with --utc instead --localtime and /etc/default/rcS with
>> UTC=yes
>

OK, I will change UTC to "no"


> That's wrong. You DEFINITELY need UTC=no because your BIOS clock is set
> by Windows to local time.
>
>> It seems it works, but... I have always 2 hour of difference between
>> Windows and Linux.
>
> Then it's not working!
>
> With the BIOS clock having been set to the correct time by Windows,
> can you then tell us the output of these at Linux boot time, please:
>
> date
> date -u
> hwclock --directisa --show --noadjtime --localtime
> hwclock --directisa --show --noadjtime --utc
>
> Thanks,
> Chris

Hi, Chris

before changing UTC to "no" in /etc/default/rcS, these are the outputs
you have requested:

(By the way, I guess "--noadjtime" is just a typo and it should be
"--noadjfile")

date
thu apr 10 10.50:32 CEST 2008

date -u
thu apr 10 8:50:34 UTC 2008

hwclock --directisa --show --noadjfile --localtime
thu apr 10 8:50:40 CEST -0.801098 seconds

hwclock --directisa --show --noadjfile --utc
thu apr 10 10:50:44 CEST -0.445415 seconds


Best regards.
Ă€ngel.
From: Àngel Català on

> Hi, Chris
>
> before changing UTC to "no" in /etc/default/rcS, these are the outputs
> you have requested:
>
> (By the way, I guess "--noadjtime" is just a typo and it should be
> "--noadjfile")
>
> date
> thu apr 10 10.50:32 CEST 2008
>
> date -u
> thu apr 10 8:50:34 UTC 2008
>
> hwclock --directisa --show --noadjfile --localtime
> thu apr 10 8:50:40 CEST -0.801098 seconds
>
> hwclock --directisa --show --noadjfile --utc
> thu apr 10 10:50:44 CEST -0.445415 seconds
>
>
> Best regards.
> Àngel.

I have changed /etc/default/rcS in this way:

1. Changed UTC=no
2. Added HWCLOCKPARS=--directisa

Then I have rebooted the laptop, and then on a shell I have typed the
command you listed me. These are the outcomes:

date:
thu apr 10 11:19:46 CEST 2008

date -u:
thu apr 10 09:19:49 UTC 2008

hwclock --directisa --show --noadjfile --localtime
thu 10 apr 2008 11:20:09 CEST -0.373740 seconds

hwclock --directisa --show --noadjfile --utc
thu 10 apr 2008 13:20:13 CEST -0.289772 seconds

Best regards.
Ă€ngel.