You are not logged in.

#1 2012-06-03 11:58:10

Allok
Member
Registered: 2012-04-30
Posts: 20

Time problem

That's my time configuration from rc.conf:

LOCALE="en_US.UTF-8"
DAEMON_LOCALE="no"
HARDWARECLOCK="localtime"
TIMEZONE="Europe/Moscow"
KEYMAP="us"
CONSOLEFONT=
CONSOLEMAP=
USECOLOR="yes"

Here's my hwclock output:

[alex@myhost ~]$ sudo hwclock --localtime
Sun 03 Jun 2012 07:55:36 AM MSK  -0.984760 seconds
[alex@myhost ~]$ sudo hwclock --utc
Sun 03 Jun 2012 11:55:41 AM MSK  -0.395457 seconds

Everything looks logical except one thing. Moscow's time is "UTC +4". Why does hwclock subtract 4 hours, not add?

Offline

#2 2012-06-03 13:01:34

carukia
Member
From: ~/United_Kingdom/Liverpool
Registered: 2011-05-15
Posts: 162

Re: Time problem

Have you read this? )The time wiki page

Offline

#3 2012-06-03 13:58:44

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

Re: Time problem

Is there a reason you're using 'localtime' as your hardwareclock? Please switch to 'utc'.

Offline

#4 2012-06-03 20:56:34

Allok
Member
Registered: 2012-04-30
Posts: 20

Re: Time problem

carukia,

Of course, I've read this article. But still I don't understand why when utc = 08 00, localtime = 04 00. It must be 08+4 00

Offline

#5 2012-06-03 21:40:26

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

Re: Time problem

I'm in UTC+2 timezone and I have the same situation, despite using UTC as my hardwareclock. Using 'hwclock --utc' gives the correct time.
I'm not sure if you understand what the switches do:

man hwclock wrote:

       -u, --utc

       --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 cho‐
              sen.  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 UTC time.

{emphasis mine)
Can you post the output of

hwclock --debug
hwclock --localtime

Offline

#6 2012-06-04 04:45:36

Allok
Member
Registered: 2012-04-30
Posts: 20

Re: Time problem

I've changed localtime to UTC for hardwareclock as karol said. After that:

[alex@myhost ~]$ sudo hwclock --debug
Password: 
hwclock from util-linux 2.21.2
Using /dev interface to clock.
Last drift adjustment done at 1338694960 seconds after 1969
Last calibration done at 1338694960 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: 2012/06/04 00:44:55
Hw clock time : 2012/06/04 00:44:55 = 1338770695 seconds since 1969
Mon 04 Jun 2012 04:44:55 AM MSK  -0.860015 seconds
[alex@myhost ~]$ sudo hwclock --localtime
Mon 04 Jun 2012 12:45:01 AM MSK  -0.641095 seconds
[alex@myhost ~]$ sudo hwclock --utc
Mon 04 Jun 2012 04:45:06 AM MSK  -0.609841 seconds

Now it adds 8 hours to the utc time..

Last edited by Allok (2012-06-04 04:46:09)

Offline

Board footer

Powered by FluxBB