You are not logged in.

#1 2010-10-08 21:52:05

ichbinder
Member
Registered: 2009-09-10
Posts: 16

[SOLVED] Time is changed after every reboot

Hello,

my Arch has strange behaviour regarding the system time. I use latest up-to-date arch with KDE. No explicite NTPD running and I don't have it in DAEMONS under rc.conf. The KDE own time & date environment is configured to not automatically change time. In /etc/rc.conf I have HARDWARECLOCK="localtime" and TIMEZONE="America/Chicago". Now from the environment to the problem:

Whenever I shutdown or restart my system, the time will be changed after booting into linux again. After shutdown with correct time using "date -s ..", the BIOS clock is correct. Then, when it actually boots into arch, there will be a delay
of 20-40 seconds for "$ date" (approximatelly the time of the reboot process) and also in the BIOS clock!
After shuting down before going to bed and restarting in the morning, the time will be approximately (or more or less exactly) the time when I shutted down... It should not be related to KDE as I observe the same behaviour when I remove kdm from daemons in rc.conf, hence, booting to console, setting time, restarting into console...
As I have dual boot: this problem is not observable using windows...

It seems like the time is stored somewhere during shutdown process and changed accordingly during reboot...?!?

Any ideas or comments? It's really crazy how annoying a wrong computer clock becomes (all IMs and system stuff is based on it...). :-(

Last edited by ichbinder (2010-10-10 09:11:01)

Offline

#2 2010-10-08 21:58:22

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Time is changed after every reboot

Offline

#3 2010-10-08 22:04:19

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,196

Re: [SOLVED] Time is changed after every reboot

That seems weird.

When you power up, what happens if, before starting your boot loader, you enter the BIOS set up and check the system time?

Other thoughts:  date -s does not set the BIOS clock, it sets the Linux kernel time.  On what do you assert that the BIOS clock is correct at shutdown.

Also, once booted into Linux, what does the command hwclock show?  This command reads the actual BIOS hardware clock.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#4 2010-10-08 22:07:43

Primoz
Member
From: Ljubljana-Slovena-EU
Registered: 2009-03-04
Posts: 688

Re: [SOLVED] Time is changed after every reboot

maybe you should start using ntp or openntpd?
It provides you with time directly from the net.


Arch x86_64 ATI AMD APU KDE frameworks 5
---------------------------------
Whatever I do, I always end up with something horribly mis-configured.

Offline

#5 2010-10-08 22:07:55

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,196

Re: [SOLVED] Time is changed after every reboot

karol wrote:

Karol, I thought about that, but ichbinder seems to imply that time stops while the system is off, and, when it boots up, system time has progressed a mere couple dozen seconds as opposed to several real-time (from an Earth centric reference frame) hours.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#6 2010-10-08 22:16:00

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Time is changed after every reboot

This doesn't fix anything, but you can try https://bugs.archlinux.org/task/13684#comment52246 - using UTC instead of localtime.

I never checked if my system clock is running perfect at all times or is /etc/cron.hourly/adjtime correcting it once in a while.

Offline

#7 2010-10-09 19:23:10

ichbinder
Member
Registered: 2009-09-10
Posts: 16

Re: [SOLVED] Time is changed after every reboot

Thanks for all the quick responses!

Primoz wrote:

maybe you should start using ntp or openntpd?
It provides you with time directly from the net.

Well, I tried to use ntp. As I am using KDE, there should already be a synchronisation service active. I can activate synchronisation in System Settings -> Date & Time and it works right after activation. But further on, e.g. after a restart - and hence such a wrong time as described in my first post - it does not correct anything. So it seems like, there is also a problem with this KDE synchronisation. But to state why I'm not using it anymore: it doesn't make much sense to use it as this is just a work around and does not solve the problem that the hardware clock might become wrong (so, e.g. I end up with a wrong clock in windows or so). In general, I just want to have a correct clock without synchronisation before I activate synchronisation. smile

ewaller wrote:

That seems weird.

When you power up, what happens if, before starting your boot loader, you enter the BIOS set up and check the system time?
...

Yes, it is. Well, if the hardware clock has been set correctly using e.g. hwclock it will be correct in BIOS before I restart arch. Similar observations for the following case:
- set HW clock correct in BIOS
- start arch ... shutdown arch
- check HW clock in BIOS -> correct
- start arch ... shutdown arch
- check HW clcok in BIOS -> incorrect


ewaller wrote:

...
Other thoughts:  date -s does not set the BIOS clock, it sets the Linux kernel time.  On what do you assert that the BIOS clock is correct at shutdown.
...

Thanks for the hint! In that case, it seems like the KDE Date & Time settings influence both, hwclock and date.

ewaller wrote:

...
Also, once booted into Linux, what does the command hwclock show?  This command reads the actual BIOS hardware clock.

Yeah, I used that alot now. So as described, it is also incorrect after a restart. But only after arch has booted again. To sum it up:

Using whatever tools to set the hardware clock and the system clock (KDE's tool, hwclock + date, or BIOS + date), both are correct until I reboot into arch the next time. If I do that, it resets both to a time similar to the last shutdown time.

karol wrote:

This doesn't fix anything, but you can try https://bugs.archlinux.org/task/13684#comment52246 - using UTC instead of localtime.

I never checked if my system clock is running perfect at all times or is /etc/cron.hourly/adjtime correcting it once in a while.

Hm, not to sure what they are doing exactly there and how this might help... :-/
What do you mean with the second part of the sentence? Not sure if /etc/chron.hourly/adjtime is doing anything in my case... How can I check if that cronjob is running?

karol wrote:

But this is very interesting! I will remove /var/lib/hwclock/adjtime  as described in the wiki and see what happens then. Thanks!

Offline

#8 2010-10-09 19:30:31

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Time is changed after every reboot

I mean, the clock can be a bit off and the cronjob running every hour [1] will correct it. You start the computer at 1.01 and for the next 59 minutes the clock shows the wrong time. At 2.00 cron runs adjtime and fixes it - the clock shows correct time.


[1] Or every-second hour: https://bugs.archlinux.org/task/18681#comment66066

Offline

#9 2010-10-09 19:57:33

ichbinder
Member
Registered: 2009-09-10
Posts: 16

Re: [SOLVED] Time is changed after every reboot

ah ok. Well, I didn't test it too extensively now, but it seems like deleteing /var/lib/hwclock/adjtime helped... I have to test it while being out of linux for a longer time. So I go and play some games now. smile

I let you know if the deleting of this file really helped. Would that make sense!?! I don't really understand, where the problem might have been. smile

Offline

#10 2010-10-09 20:01:48

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Time is changed after every reboot

Deleting /var/lib/hwclock/adjtime is my one-line response to time-related problems, but it may not work for you, as the symptoms you describe are a bit different than the usual "my clock is off, please help". We'll see.

Have fun playing games :-)

Offline

#11 2010-10-09 23:00:13

ichbinder
Member
Registered: 2009-09-10
Posts: 16

Re: [SOLVED] Time is changed after every reboot

karol wrote:

Deleting /var/lib/hwclock/adjtime is my one-line response to time-related problems, but it may not work for you, as the symptoms you describe are a bit different than the usual "my clock is off, please help". We'll see.

Have fun playing games :-)

Well, somehow, it seems to help. The time is still correct after multiple hours in Windows and then booting back into linux. What is it with this file?! Thanks a lot!

I hope I'm not too fast with marking this thread as [SOLVED]

If you or anybody else got a comment on /var/lib/hwclock/adjtime, I'm still curious and would like to understand, what was the problem! smile

Offline

#12 2010-10-09 23:02:06

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Time is changed after every reboot

How about 'man hwclock'? :-)
'The Adjust Function' part of the man page deals with that file.

Last edited by karol (2010-10-09 23:08:04)

Offline

#13 2010-10-10 09:10:42

ichbinder
Member
Registered: 2009-09-10
Posts: 16

Re: [SOLVED] Time is changed after every reboot

karol wrote:

How about 'man hwclock'? :-)
'The Adjust Function' part of the man page deals with that file.

Yeah, I'm not looking enough on man pages... ;-) Pretty good description, even though the location of the file is not correct... smile
Thanks for the hint! And thanks to all that tried to help me!

Offline

#14 2011-08-09 10:29:18

jell
Member
Registered: 2011-01-27
Posts: 3

Re: [SOLVED] Time is changed after every reboot

Setting
HARDWARECLOCK="UTC"
TIMEZONE="Asia/Kolkata"


in rc.conf solved the issue for me... smile

Offline

Board footer

Powered by FluxBB