Author Topic: Clock not keeping correct time between reboots  (Read 4887 times)

Offline The Chief

  • Hero Member
  • *****
  • Posts: 2339
Re: Clock not keeping correct time between reboots
« Reply #30 on: April 17, 2010, 04:22:50 PM »
And why set it to local time? That's a Windows thing.


Well, I want it to display local time, and it's not moving around the time zones, so why not?

Retired Senior Chief, Retired Software Engineer, Active GrandPa

Online luikki

  • Hero Member
  • *****
  • Posts: 1422
Re: Clock not keeping correct time between reboots
« Reply #31 on: April 17, 2010, 04:41:22 PM »
blackbird,

at the moment i'm not at the pc giving the trouble but i know from memory that /etc/sysconfig/clock is:

Quote
UTC=true
ARC=false
ZONE="Europe/Lisbon"

the problem remains even  if i've utc set to "false".

but i just noticed that on the pc i'm using now - pclinuxos 2009 - running perfectly, etc/sysconfig/clock, looks slightly different:

UTC=false
ARC=false
ZONE=America/Chicago      (i never changed the  default time  zone, still it runs faultless... correct bios and system time)

zone has no quotes ...

thanks for you interest.


Offline Bald Brick

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6471
  • I'm going South
Re: Clock not keeping correct time between reboots
« Reply #32 on: April 17, 2010, 05:09:52 PM »
but i just noticed that on the pc i'm using now - pclinuxos 2009 - running perfectly, etc/sysconfig/clock, looks slightly different:

UTC=false
ARC=false
ZONE=America/Chicago      (i never changed the  default time  zone, still it runs faultless... correct bios and system time)

zone has no quotes ...

If UTC is set to "false", the system simply infers that the hardware clock and the system clock are in the same time zone. If that time zone is set to be Chicago  while you're actually in Portugal shouldn't matter once you've adjusted your clocks to Lisbon time -- unless Daylight-Saving Time starts or ends at different dates in Illinois and Portugal. (The system doesn't care where you really are, but if you lie about it, you have to do so consistently.)

Everything else in this thread is more mysterious.
« Last Edit: April 17, 2010, 05:18:11 PM by blackbird »
Feed the trolls!
They need it!

AMD Athlon 7450 Dual-Core Processor, 7.80 GiB RAM, Nvidia GeForce GT 120/PCIe/SSE2, OpenGL/ES-version: 3.3 0 NVIDIA 295.40, SBx00 Azalia (Intel HDA) soundcard, ‎Logitech B500 webcam, SAA7146 DVB card, HDDs: Seagate 250824AS, Western Digital WD10EAVS-00D

Offline Galaxar

  • Full Member
  • ***
  • Posts: 121
Re: Clock not keeping correct time between reboots
« Reply #33 on: April 17, 2010, 05:42:35 PM »
just for reference,  mine looks like this.

UTC=true
ARC=false
ZONE=America/Chicago

Galaxar

Offline Bald Brick

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6471
  • I'm going South
Re: Clock not keeping correct time between reboots
« Reply #34 on: April 18, 2010, 06:37:09 AM »
just for reference,  mine looks like this.

UTC=true
ARC=false
ZONE=America/Chicago

Galaxar

Galaxar and luikki,

It seems that JohnBoy was entirely correct. With Galaxar's setting the system clock should be five hours off from the BIOS clock, and with luikkis' it should be one hour off. If you both set UTC to "false" instead of "true", the system clock and the hardware clock should both be set to local time.

The mystery is why the hardware clock isn't synchronized to the system clock at reboot. So:

1. Try changing UTC=true to UTC=false in /etc/sysconfig/clock (as root).

2. Then check that your system time is correct (or change it in PCC).

3. Open konsole and su to root.

4. Run hwclock --localtime.
5. Run hwclock -w.

Edit:
4. and 5. should be replaced by

4. Run
Code: [Select]
hwclock -w --localtime

5. Check that the third line in the file /etc/adjtime reads LOCAL and not UTC.

6. Reboot.

Report any error messages from the hwclock command. If hwclock -w won't synchronize the clocks, you probably have to set the hardware clock manually in the BIOS settings -- but it should work.

« Last Edit: April 18, 2010, 10:58:27 AM by blackbird »
Feed the trolls!
They need it!

AMD Athlon 7450 Dual-Core Processor, 7.80 GiB RAM, Nvidia GeForce GT 120/PCIe/SSE2, OpenGL/ES-version: 3.3 0 NVIDIA 295.40, SBx00 Azalia (Intel HDA) soundcard, ‎Logitech B500 webcam, SAA7146 DVB card, HDDs: Seagate 250824AS, Western Digital WD10EAVS-00D

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6849
  • MLU
Re: Clock not keeping correct time between reboots
« Reply #35 on: April 18, 2010, 07:07:20 AM »
It seems the only difference in my approach is that I regard the BIOS clock setting as sacrosanct.
I set it manually and everything I install uses that setting as reference and does not change it.

In that manner regardless how many OSs are installed the BIOS clock is not changed by any of them.
In truth, if I could lock the BIOS clock separately, I would, to prevent everything except a BIOS edit from changing it.

I have found this approach to be the most suitable for me .....  particularly when I had many many distros installed on the one PC, and even included a few Win installs also (way back when ;) )

There are a few different edit points for locale/time zone and I usually find, when the clock is wrong, that I have missed one of them. Truthfully I can never remember the best way to set it up through GUI. It is more a bit of trial and trying to remember every time I install anew.  ;D

Hopefully things are getting sorted now for those with wrong time displays.

Online luikki

  • Hero Member
  • *****
  • Posts: 1422
Re: Clock not keeping correct time between reboots
« Reply #36 on: April 18, 2010, 09:00:47 AM »
blackbird,
i started by correcting the time in bios to the present local time...
then:
1 - done
2 - checked. shows correct time.
3 - done
4 - # hwclock --localtime
Sun 18 Apr 2010 03:48:38 PM WEST  -0.344358 seconds
( this is the correct local time)
5 - it shows no errors
6 - after reboot, bios clock is, again, one hour behind - 02:48:38 - and  login clock is one hour fast - 04:49:48... pclinuxos clock remains correct.

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6849
  • MLU
Re: Clock not keeping correct time between reboots
« Reply #37 on: April 18, 2010, 09:48:53 AM »
Code: [Select]
--localtime
 Indicates that the Hardware Clock is kept in Coordinated Universal Time or local time, respectively. It is your choice whether to keep your clock in UTC or local time, but nothing in the clock tells which you've chosen. So this option is how you give that information to hwclock.
 If you specify the wrong one of these options (or specify neither and take a wrong default), both setting and querying of the Hardware Clock will be messed up.
 If you specify neither --utc nor --localtime , the default is whichever was specified the last time hwclock was used to set the clock (i.e. hwclock was successfully run with the --set , --systohc , or --adjust options), as recorded in the adjtime file. If the adjtime file doesn't exist, the default is local time.

Just wondering ....  if you had set the correct time in BIOS why set the time again using the command?


Offline Bald Brick

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6471
  • I'm going South
Re: Clock not keeping correct time between reboots
« Reply #38 on: April 18, 2010, 10:28:23 AM »
blackbird,
i started by correcting the time in bios to the present local time...
then:
1 - done
2 - checked. shows correct time.
3 - done
4 - # hwclock --localtime
Sun 18 Apr 2010 03:48:38 PM WEST  -0.344358 seconds
( this is the correct local time)
5 - it shows no errors
6 - after reboot, bios clock is, again, one hour behind - 02:48:38 - and  login clock is one hour fast - 04:49:48... pclinuxos clock remains correct.

I probably made a mistake in splitting the hwclock command into too commands. (-w is a function; --localtime is an option.) Would
Code: [Select]
hwclock -w --localtimework better?

Your problem could stem from the fact that UTC is set as the default in the file /etc/adjtime. Try manually changing the third line from UTC to LOCAL. (I thought hwclock --localtime would do precisely that, but I didn't test it.)

If the above doesn't work, I'll check out all changes on my box. (I won't do it before you've tried it as I have my BIOS clock intentionally set to UTC and every time I change it to local time and back my ntp daemon croaks and has to be restarted.)
« Last Edit: April 18, 2010, 10:33:56 AM by blackbird »
Feed the trolls!
They need it!

AMD Athlon 7450 Dual-Core Processor, 7.80 GiB RAM, Nvidia GeForce GT 120/PCIe/SSE2, OpenGL/ES-version: 3.3 0 NVIDIA 295.40, SBx00 Azalia (Intel HDA) soundcard, ‎Logitech B500 webcam, SAA7146 DVB card, HDDs: Seagate 250824AS, Western Digital WD10EAVS-00D

Online luikki

  • Hero Member
  • *****
  • Posts: 1422
Re: Clock not keeping correct time between reboots
« Reply #39 on: April 18, 2010, 10:34:55 AM »
Indicates that the Hardware Clock is kept in Coordinated Universal Time or local time.

i believe this is correct but:

with the correct local time in bios clock i get the login clock showing one hour fast and the system time is correct...
on next reboot, bios clock will be one hour behind, login and system clock will be both correct to local time...
what puzzles me: what makes  the bios clock be one hour behind?
i've never experienced this kind of "problem"... not even in dual boot machines (my laptop and my main system, both  with winzows + pclinuxos 2009 behave correctly).

Online luikki

  • Hero Member
  • *****
  • Posts: 1422
Re: Clock not keeping correct time between reboots
« Reply #40 on: April 18, 2010, 10:50:48 AM »
blackbird, thanks a million!

i manually changed /etc/adjtime to local and problem is solved!
now, time remains correct in bios, login screen and system...

once again, thank you for your patience and help.

Offline Bald Brick

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6471
  • I'm going South
Re: Clock not keeping correct time between reboots
« Reply #41 on: April 18, 2010, 11:06:56 AM »
i manually changed /etc/adjtime to local and problem is solved!

 ;D ;D Glad it worked. Sorry I didn't think of it sooner. (It was JohnBoy's quote from the hwclock man page that revitalized my memory.)
« Last Edit: April 18, 2010, 11:16:20 AM by blackbird »
Feed the trolls!
They need it!

AMD Athlon 7450 Dual-Core Processor, 7.80 GiB RAM, Nvidia GeForce GT 120/PCIe/SSE2, OpenGL/ES-version: 3.3 0 NVIDIA 295.40, SBx00 Azalia (Intel HDA) soundcard, ‎Logitech B500 webcam, SAA7146 DVB card, HDDs: Seagate 250824AS, Western Digital WD10EAVS-00D

Offline Galaxar

  • Full Member
  • ***
  • Posts: 121
Re: Clock not keeping correct time between reboots
« Reply #42 on: April 18, 2010, 02:24:24 PM »
no go for me.  tried all the suggestions.  nothing.  and when tried to run the hwclock with the options and such, i got this.

hwclock -w --localtime
select() to /dev/rtc to wait for clock tick timed out

Edit:
So now we are back to that error message.  I just wanna say thanks to all that have tried to help me.  I really appreciate it.


Galaxar
« Last Edit: April 18, 2010, 02:44:33 PM by Galaxar »

Offline Bald Brick

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6471
  • I'm going South
Re: Clock not keeping correct time between reboots
« Reply #43 on: April 18, 2010, 03:24:13 PM »
no go for me.  tried all the suggestions.  nothing.  and when tried to run the hwclock with the options and such, i got this.

hwclock -w --localtime
select() to /dev/rtc to wait for clock tick timed out

At least I was right about one thing: your problem is not the same as luikki's. And it is related to setting the hardware clock.

If you change the above command line to
Code: [Select]
hwclock -w --localtime --directisa
Does that work?

(You'd still have to change UTC to LOCAL in /etc/adjtime, and UTC=true to UTC=false in /etc/sysconfig/clock.)
« Last Edit: April 18, 2010, 03:30:48 PM by blackbird »
Feed the trolls!
They need it!

AMD Athlon 7450 Dual-Core Processor, 7.80 GiB RAM, Nvidia GeForce GT 120/PCIe/SSE2, OpenGL/ES-version: 3.3 0 NVIDIA 295.40, SBx00 Azalia (Intel HDA) soundcard, ‎Logitech B500 webcam, SAA7146 DVB card, HDDs: Seagate 250824AS, Western Digital WD10EAVS-00D

Offline Galaxar

  • Full Member
  • ***
  • Posts: 121
Re: Clock not keeping correct time between reboots
« Reply #44 on: April 18, 2010, 03:50:39 PM »
contents of adjtime:
-0.047190 1271626785 0.000000
1271626785
LOCAL

contents of /etc/sysconfig/clock
UTC=false
ARC=false
ZONE=America/Chicago

when i tried hwclock -w --localtime --directisa
the error message "elect() to /dev/rtc to wait for clock tick timed out"  DID NOT show up.  it looked like it worked, but when i rebooted, still 5 hours back.

Galaxar