Time/clock resets-random on 11.3

Please help Im finding this extremely annoying. I done searches for “clock” and found similar threads, but no real fix that is working for me.

My clock resets when I boot into linux. It does not happen in windows or bios even on cold boots. The battery is replaced and good**

** the old battery was by all measures dead (0.6v), but still seemed to have enough power for the clock, since windows tested fine with it.

I have tryed setting it to local time, UTC… etc… My timezone is GMT (london).
“sudo /sbin/hwclock --systohc”

Although I have windows, I do not use it except the few times to test this, so no conflict.

thanks
Mark

Is it random or a fixed amount?

seems random to me, right now 4:09pm

real time is 11:09, +5 hours

Im guessing if the battery ran out it would be resetting to 12:00, but only been turned on 1 hour.

thanks

See if it is always + 5 hours.

The hardware clock is only consulted at boot then the internal OS clock keeps time from the on.

Since you live at GMT your time will be UTC ± any political daylight savings rules.

By default Windows assumes the the HWC is set to local time. By default Linux assumes HWC is UTC Both need to be set to the same assumption if you dual boot. But for you Local and UTC would be the same. You could always boot to the BIOS and see what time the HWC thinks it is.

It does now seem to always be +5 hours, indeed thinks im in the US.

is this due to the bureaucracy of linux… of having 5 different UIs to do the same task, and one being stubborn :stuck_out_tongue:

Also I belive linux writes back the clock to HWC on shut down, the bios is always wrong after restarting (but not cold!). infact, can I make the HWC read only ? :smiley:

what part is doing stuff on boot? that needs to be changed?

I set it to use a time server, = fix, but it doesnt use it on boot.

Something new, I was fixing a wireless router today, and this pc was the only thing connected, and it ABSORBED the time from it :confused:

Does my new shiny install run a time server by default?

thanks
Mark

On 2010-09-05 01:36, Kramdra wrote:
>
> It does now seem to always be +5 hours, indeed thinks im in the US.

Get to a terminal (xterm, whatever), get yourself root (“su -”), then type “date”. What do you see?
Then type: “TZ=Europe/London date” and compare.

For example:

Elessar:~ # TZ=Europe/London date ; TZ=America/New_York date ; date
Sun Sep 5 04:09:54 BST 2010
Sat Sep 4 23:09:54 EDT 2010
Sun Sep 5 05:09:54 CEST 2010

I’m guessing that “date” alone does not print the correct time zone for you. Get into Yast and
correct it.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” GM (Elessar))

interesting…

kram@linux-5ym5:~> TZ=Europe/London date ; TZ=America/New_York date ; date
Sun Sep 5 16:31:05 BST 2010
Sun Sep 5 11:31:05 EDT 2010
Sun Sep 5 16:31:05 BST 2010

ah ha! but no the time is 11:31am, BST…

yast has the correct timezone set…

Also, I did not set the time, or timezone when installing, waited untill after.

thanks
Mark

On 2010-09-05 12:36, Kramdra wrote:
>
> interesting…
>
> kram@linux-5ym5:~> TZ=Europe/London date ; TZ=America/New_York date ;
> date
> Sun Sep 5 16:31:05 BST 2010
> Sun Sep 5 11:31:05 EDT 2010
> Sun Sep 5 16:31:05 BST 2010
>
>
>
> ah ha! but no the time is 11:31am, BST…

So, the timezone is correct, BST, but the time is not. YOu should check that “root” gets the same
result as the user.

Ok, then “su -” to get yourself root; using the command “date --set=11:31” set the time to the
correct hour (BST). And do this sequence:

grep HWCLOCK /etc/sysconfig/clock

It will be “-u” “–utc”, or “–localtime”. Take a note and enter it in the command sequence below as
appropiate:


rm /etc/adjtime ; hwclock --utc --systohc ; hwclock ; date


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” GM (Elessar))

awesome
I did not know of etc/sysconfig/clock. I already looked for /etc/adjtime, though.

in sysconfig/clock I had a line “default timezone= US /eastern” at the bottom - directly below “timezone = europe/london”
I think changing that should be the fix, thanks very much for the help :slight_smile:

Mark

On 2010-09-06 00:36, Kramdra wrote:
>
> awesome
> I did not know of etc/sysconfig/clock. I already looked for
> /etc/adjtime, though.
>
> in sysconfig/clock I had a line “default timezone= US /eastern” at the
> bottom - directly below “timezone = europe/london”
> I think changing that should be the fix, thanks very much for the help
> :slight_smile:

Two timezones defined!? That’s new. Probably some tools where using the last definition (bash
scripts) and other would be using the first one (greps).

Hold on, it is not the same variable. In fact, I have something similar and it works fine for me:

TIMEZONE=“Europe/Madrid”
DEFAULT_TIMEZONE=“US/Eastern”

And so far, no effects. I don’t know who/what uses DEFAULT_TIMEZONE.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” GM (Elessar))

well, it didnt seem to help :frowning:

any ideas?

thanks
Mark

On 2010-09-06 11:06, Kramdra wrote:
>
> well, it didnt seem to help :frowning:
>
> any ideas?

Copy the output of (as root):

grep HWCLOCK /etc/sysconfig/clock

hwclock --show; date


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” GM (Elessar))

Maybe I should have asked earlier but where are you changing the timezone?

Yast is system wide but you also can change it for each user on the desktop right click clock and select settings.

linux-5ym5:~ # grep HWCLOCK /etc/sysconfig/clock
HWCLOCK="–localtime"
linux-5ym5:~ # hwclock --show; date
Tue Sep 7 11:30:40 2010 -0.330555 seconds
Tue Sep 7 16:30:40 BST 2010

linux-5ym5:~ # hwclock --hctosys
linux-5ym5:~ # hwclock --show; date
Tue Sep 7 11:48:26 2010 -0.148793 seconds
Tue Sep 7 11:48:26 BST 2010

maybe it will stick :slight_smile:

linux-5ym5:~ # hwclock --show; date
Wed Sep 8 10:31:42 2010 -0.596414 seconds
Wed Sep 8 15:31:41 BST 2010

the update yesterday (local time lock related) didnt help :confused: well atleast its easyer to do -hctosys than typing in the time

Is there a good way of running scripts, that need root, without putting my root password in them? - not just for this

On 2010-09-08 12:06, Kramdra wrote:
>
> linux-5ym5:~ # hwclock --show; date
> Wed Sep 8 10:31:42 2010 -0.596414 seconds
> Wed Sep 8 15:31:41 BST 2010
>
> the update yesterday (local time lock related) didnt help :confused: well
> atleast its easyer to do -hctosys than typing in the time

hctosys assumes that the cmos is correct and system is incorrect. Don’t forget to delete adjtime
after such a change, and recreate it with the other command I posted.

> Is there a good way of running scripts, that need root, without
> putting my root password in them? - not just for this

Write the root password inside a script? Never do that. Just use sudo, or su.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” GM (Elessar))

On 2010-09-07 13:06, Kramdra wrote:
>
> linux-5ym5:~ # hwclock --hctosys
> linux-5ym5:~ # hwclock --show; date
> Tue Sep 7 11:48:26 2010 -0.148793 seconds
> Tue Sep 7 11:48:26 BST 2010
>
> maybe it will stick :slight_smile:

Now delete /etc/adjtime. Then run “hwclock --systohc --localtime”


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” GM (Elessar))