You are not logged in.

#1 2011-05-29 10:03:56

vajorie
Member
Registered: 2009-03-12
Posts: 66

[solved] Time changed incorrectly after every boot

I'm not sure how or why this started occuring (maybe after an upgrade? cannot trace it to anything specific), but everytime I boot/reboot my laptop/netbook, I find that the time is incorrect. Right now, it shows 1:56am even though the correct time should have been 5:56am (EDT).

Edit: I think it saves the clock incorrectly while halting, as everytime I reboot, fsck complains about time being incorrect while it is mounting the filesystems.

Edit 2: The time in my bios is the same as the time that hwclock reports below.

Here are some output that I think may be relevant; please let me know if you need more --thanks so much for your help in advance...

$ hwclock -r
Sun 29 May 2011 05:58:14 AM EDT  -0.798014 seconds # this is correct

$ date
Sun May 29 01:58:36 EDT 2011 # this is incorrect

$ cat /etc/rc.conf | grep CLOCK
HARDWARECLOCK="UTC"

$ cat /etc/rc.conf | grep TIME
TIMEZONE="America/New_York"

$ cat /etc/ntp.conf  # I removed the commented lines; I have ntpd in my rc.conf as a daemon
server pool.ntp.org
restrict default nomodify nopeer
restrict 127.0.0.1
driftfile       /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log

I keep doing "hwclock -s" after every boot...
Again, thanks in advance smile

Last edited by vajorie (2011-05-30 04:56:57)

Offline

#2 2011-05-29 10:15:06

archpastor
Member
From: Indonesia
Registered: 2011-05-26
Posts: 3

Re: [solved] Time changed incorrectly after every boot

Vajorie,

Try changing HARDWARECLOCK="UTC" to HARDWARECLOCK="localtime" in your /etc/rc.conf, reboot and see if this fixes your problem.

Cheers

Offline

#3 2011-05-29 10:25:09

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

Re: [solved] Time changed incorrectly after every boot

archpastor wrote:

Vajorie,

Try changing HARDWARECLOCK="UTC" to HARDWARECLOCK="localtime" in your /etc/rc.conf, reboot and see if this fixes your problem.

Cheers

Using "localtime" is discouraged.
https://wiki.archlinux.org/index.php/Rc.conf



@ vajorie
I think that you use UTC for some reason (EDT = UTC -4, right?).
What does 'hwclock --debug' show?

Last edited by karol (2011-05-29 10:46:06)

Offline

#4 2011-05-29 11:19:43

archpastor
Member
From: Indonesia
Registered: 2011-05-26
Posts: 3

Re: [solved] Time changed incorrectly after every boot

Karol,

Sorry, didn't realize it was discouraged. Here, I have to run on 'localtime' because Indonesia doesn't follow DST and if I run 'UTC' my clock is off by 1 hour every April until October :-(

Offline

#5 2011-05-29 11:26:01

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

Re: [solved] Time changed incorrectly after every boot

archpastor wrote:

Karol,

Sorry, didn't realize it was discouraged. Here, I have to run on 'localtime' because Indonesia doesn't follow DST and if I run 'UTC' my clock is off by 1 hour every April until October :-(

In this case you should set your clock to UTC and make the changes manually: https://wiki.archlinux.org/index.php/Rc … calization (the first note).

Offline

#6 2011-05-29 11:34:03

vajorie
Member
Registered: 2009-03-12
Posts: 66

Re: [solved] Time changed incorrectly after every boot

@ vajorie
I think that you use UTC for some reason (EDT = UTC -4, right?).
What does 'hwclock --debug' show?

Yes, I think so:

$ hwclock --debug

hwclock from util-linux 2.19.1
Using /dev interface to clock.
Last drift adjustment done at 1305618990 seconds after 1969
Last calibration done at 1305618990 seconds after 1969
Hardware clock is on local time
Assuming hardware clock is kept in local time.
Waiting for clock tick...
...got clock tick
Time read from Hardware Clock: 2011/05/29 07:22:53
Hw clock time : 2011/05/29 07:22:53 = 1306668173 seconds since 1969
Sun 29 May 2011 07:22:53 AM EDT  -0.456159 seconds

PS. For Karol, wouldn't that be considered a bug in tzdata ( http://www.twinsun.com/tz/tz-link.htm )?

Offline

#7 2011-05-29 11:40:57

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

Re: [solved] Time changed incorrectly after every boot

Why don't you have hwclock set to UTC (like you have in your rc.conf)?

[karol@black ~]$ LC_ALL=C hwclock --debug
hwclock from util-linux 2.19.1
Using /dev interface to clock.
Last drift adjustment done at 1304889660 seconds after 1969
Last calibration done at 1304827834 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
...got clock tick
Time read from Hardware Clock: 2011/05/29 11:45:21
Hw clock time : 2011/05/29 11:45:21 = 1306669521 seconds since 1969
Sun May 29 13:45:21 2011  -0.844813 seconds

(I used 'LC_ALL=C' to print the info in English, the time is the same with or w//o it).
Both 'date' and 'hwclock -r' show correct local time: CEST = UTC +2.

[karol@black ~]$ LC_ALL=C hwclock -r
Sun May 29 13:50:02 2011  -0.445952 seconds
[karol@black ~]$ LC_ALL=C date
Sun May 29 13:50:09 CEST 2011
[karol@black ~]$ grep -i -e clock -e timezone /etc/rc.conf | grep -v ^#
HARDWARECLOCK="UTC"
TIMEZONE="Europe/Warsaw"

Last edited by karol (2011-05-29 11:47:20)

Offline

#8 2011-05-29 11:51:39

SS4
Member
From: !Rochford, Essex
Registered: 2010-12-05
Posts: 699

Re: [solved] Time changed incorrectly after every boot

ntp runs fine without hwclock so you can blacklist the hwclock in rc.conf

https://wiki.archlinux.org/index.php/NT … s_a_daemon


Rauchen verboten

Offline

#9 2011-05-29 17:52:00

vajorie
Member
Registered: 2009-03-12
Posts: 66

Re: [solved] Time changed incorrectly after every boot

karol wrote:

Why don't you have hwclock set to UTC (like you have in your rc.conf)?

I think this fixed it. Rebooted twice, once with the laptop plugged in and once unplugged, and the clock stays the same so far. Thanks! I'll come back and label it as fixed if the thing doesn't come back to haunt me again smile

SS4 wrote:

ntp runs fine without hwclock so you can blacklist the hwclock in rc.conf

I wanted to know what the problem was being caused by. (If I am now,) I wasn't being affected by the hwclock v ntpd conflict until recently. I wonder what I did to set hwclock to local time (or, rather, if I did something; I didn't know hwclock could be set by UTC or localtime and that setting it to localtime could cause a problem).

Last edited by vajorie (2011-05-29 17:54:47)

Offline

#10 2011-05-29 18:54:10

skodabenz
Banned
From: Tamilnadu, India
Registered: 2010-04-11
Posts: 382

Re: [solved] Time changed incorrectly after every boot

@vajorie: If you are dual-booting with Windows, the it is possible to make Windows use UTC https://help.ubuntu.com/community/Ubunt … 0use%20UTC . This will make Windows not touch the hardware clock at all and therefore you may have to set the hardware cloack to correct UTC time using ntp and hwclock manually.

sudo ntpd -qg &    # https://wiki.archlinux.org/index.php/Network_Time_Protocol_daemon#Syncing_the_clock_without_running_the_daemon
sudo hwclock --utc --systohc    #  Set HW clock to UTC and sync it with System Software time as the standard
sudo hwclock --show    #  to check the time

Last edited by skodabenz (2011-05-29 19:01:29)


My new forum user/nick name is "the.ridikulus.rat" .

Offline

#11 2011-05-30 01:23:41

vajorie
Member
Registered: 2009-03-12
Posts: 66

Re: [solved] Time changed incorrectly after every boot

skodabenz wrote:

@vajorie: If you are dual-booting with Windows, the it is possible to make Windows use UTC https://help.ubuntu.com/community/Ubunt … 0use%20UTC . This will make Windows not touch the hardware clock at all and therefore you may have to set the hardware cloack to correct UTC time using ntp and hwclock manually.

sudo ntpd -qg &    # https://wiki.archlinux.org/index.php/Network_Time_Protocol_daemon#Syncing_the_clock_without_running_the_daemon
sudo hwclock --utc --systohc    #  Set HW clock to UTC and sync it with System Software time as the standard
sudo hwclock --show    #  to check the time

Thanks Skoda, but this is an arch-only install smile

Offline

Board footer

Powered by FluxBB