You are not logged in.

#1 2012-08-06 21:25:19

Super Root
Member
Registered: 2012-08-04
Posts: 23

localtime not working ?

The time is now ( just an example ) 00:23 ( localtime ), but it shows 03:23 ( UTC ).

[dainis@arch ~]$ cat /etc/timezone 
Europe/Riga
[dainis@arch ~]$ ls -l /etc/ | grep localtime
lrwxrwxrwx 1 root root     31 Aug  7 00:56 localtime -> /usr/share/zoneinfo/Europe/Riga
[dainis@arch ~]$ cat /etc/adjtime 
0.000000 1344298258 0.000000
1344298258
LOCAL

What am I missing here ?


Simplicity is prerequisite for reliability.   -- Edsger Dijkstra

Offline

#2 2012-08-06 21:31:40

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

Re: localtime not working ?

Please post the output of hwclock --debug


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#3 2012-08-06 21:32:45

Super Root
Member
Registered: 2012-08-04
Posts: 23

Re: localtime not working ?

[dainis@arch ~]$ hwclock --debug
hwclock from util-linux 2.21.2
Using /dev interface to clock.
Last drift adjustment done at 1344299002 seconds after 1969
Last calibration done at 1344299002 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: 2012/08/07 03:32:06
Hw clock time : 2012/08/07 03:32:06 = 1344299526 seconds since 1969
Tue Aug  7 03:32:06 2012  -0.145594 seconds

Simplicity is prerequisite for reliability.   -- Edsger Dijkstra

Offline

#4 2012-08-06 21:47:50

tinte
Member
Registered: 2012-07-20
Posts: 15

Re: localtime not working ?

I had the same problem until I set HARDWARECLOCK="UTC" in /etc/rc.conf

Offline

#5 2012-08-06 21:53:42

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

Re: localtime not working ?

tinte got it right.  Your hardware clock (the BIOS clock) is set to UTC.  You told the kernel, however, that the hardware clock is set to local time, so it does not apply the -3 hour delta.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#6 2012-08-06 22:08:30

Super Root
Member
Registered: 2012-08-04
Posts: 23

Re: localtime not working ?

tinte wrote:

I had the same problem until I set HARDWARECLOCK="UTC" in /etc/rc.conf

ewaller wrote:

tinte got it right.  Your hardware clock (the BIOS clock) is set to UTC.  You told the kernel, however, that the hardware clock is set to local time, so it does not apply the -3 hour delta.

I thought setting this in rc.conf is deprecated ? Anyway, it is still not ok - now it's showing 07:07 ( UTC +3 ), while it should be only 01:07 ( localtime ).


Simplicity is prerequisite for reliability.   -- Edsger Dijkstra

Offline

#7 2012-08-06 22:24:46

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

Re: localtime not working ?

Did you reboot?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#8 2012-08-06 23:53:06

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: localtime not working ?

Super Root wrote:

I thought setting this in rc.conf is deprecated ?

Users are encouraged to use the new config files, but rc.conf works as expected, unless the man page states otherwise.

Offline

#9 2012-08-07 15:32:34

Super Root
Member
Registered: 2012-08-04
Posts: 23

Re: localtime not working ?

ewaller wrote:

Did you reboot?

Yes ( several times ).


Simplicity is prerequisite for reliability.   -- Edsger Dijkstra

Offline

#10 2012-08-07 16:20:52

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

Re: localtime not working ?

Oh, very well smile

Can you do another hwclock --debug
??


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#11 2012-08-07 16:55:36

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: localtime not working ?

Super Root wrote:

The time is now ( just an example ) 00:23 ( localtime ), but it shows 03:23 ( UTC ).

[dainis@arch ~]$ cat /etc/timezone 
Europe/Riga
[dainis@arch ~]$ ls -l /etc/ | grep localtime
lrwxrwxrwx 1 root root     31 Aug  7 00:56 localtime -> /usr/share/zoneinfo/Europe/Riga
[dainis@arch ~]$ cat /etc/adjtime 
0.000000 1344298258 0.000000
1344298258
LOCAL

What am I missing here ?

You need to set the systemtime correctly, then do a "hwclock -w --local" to write it back to the rtc (or something along those line, double-check with man).

Offline

#12 2012-08-07 17:04:37

Super Root
Member
Registered: 2012-08-04
Posts: 23

Re: localtime not working ?

ewaller wrote:

Oh, very well smile

Can you do another hwclock --debug
??

Sure!

[dainis@arch ~]$ hwclock --debug
hwclock from util-linux 2.21.2
Using /dev interface to clock.
Last drift adjustment done at 1344299002 seconds after 1969
Last calibration done at 1344299002 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: 2012/08/07 22:59:21
Hw clock time : 2012/08/07 22:59:21 = 1344369561 seconds since 1969
Tue Aug  7 22:59:21 2012  -0.594550 seconds
[dainis@arch ~]$ cat /etc/rc.conf | grep HARDWARECLOCK
HARDWARECLOCK="UTC"

[dainis@arch ~]$ cat /etc/adjtime 
0.000000 1344299002 0.000000
1344299002
LOCAL

[dainis@arch ~]$ ls -l /etc | grep localtime
lrwxrwxrwx 1 root root     31 Aug  7 00:56 localtime -> /usr/share/zoneinfo/Europe/Riga

What's even more confusing ?

Current situation:

actual time: 20:03
hwclock: 23:03
date output: 02:03

Can anybody tell me what is going on here ? hmm


Simplicity is prerequisite for reliability.   -- Edsger Dijkstra

Offline

#13 2012-08-07 17:17:21

Lennie
Member
From: Sweden
Registered: 2011-10-12
Posts: 146

Re: localtime not working ?

Your hardware clock is using localtime, as your debug shows. That's not changed by just putting UTC in rc.conf. You need to set it to the correct time, and tell it to use UTC. (If that's what you want to use.) https://wiki.archlinux.org/index.php/Time

Offline

#14 2012-08-07 19:44:04

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

Re: localtime not working ?

Delete /etc/adjtime and reboot.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB