# hwclock shows local time as -2h, but should +2h [SOLVED]

## byebye

Hi, I'm from Poland and I've just started the adventure with Gentoo. Sorry for language mistakes  :Wink: 

I have a little problem with time on my machine. This is my configuration:

Kernel (3.2.12): 

 *Quote:*   

> CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
> 
> CONFIG_RTC_HCTOSYS=y

 

/etc/timezone:

 *Quote:*   

> Europe/Warsaw

 

/etc/localtime = /usr/share/zoneinfo/Europe/Warsaw

/etc/conf.d/hwclock:

 *Quote:*   

> clock="local"
> 
> clock_systohc="NO"
> 
> clock_hctosys="NO"
> ...

 

And here is the issue:

BIOS time: 8:30:00

```
# date

Sat Apr 14 08:30:00 CEST 2012

# date --utc

Sat Apr 14 06:30:00 UTC 2012

# hwclock

Sat Apr 14 10:30:00

# hwclock --utc

Sat Apr 14 10:30:00

# hwclock --local

Sat Apr 14 08:30:00
```

After change clock="UTC" in /etc/conf.d/hwclock:

```
# date

Sat Apr 14 10:30:00 CEST 2012

# date --utc

Sat Apr 14 08:30:00 UTC 2012

# hwclock

Sat Apr 14 10:30:00

# hwclock --utc

Sat Apr 14 10:30:00

# hwclock --local

Sat Apr 14 08:30:00
```

So, how you can see, hwclock shows local time as -2 hours in relation to UTC - but it should be +2 hours. Also, 'clock' variable in /etc/conf.d/hwclock doesn't affect on it.

Have you any suggestions why is this happens?

Thanks  :Smile: Last edited by byebye on Sun Apr 15, 2012 3:20 pm; edited 1 time in total

----------

## BillWho

byebye,

I had a rough time with the clock when I first setup gentoo, but it's been fine for several years now on three machines.

Here's my info:

contents of /etc/conf.d/hwclock

clock="local"

#clock_hctosys="NO"

#clock_systohc="YES"

clock_args=""

root@gentoo-gateway linux # rc-update|grep hwclock

              hwclock | boot                         

root@gentoo-gateway linux # readlink /etc/localtime

/usr/share/zoneinfo/America/New_York

I set a symlink to the time zone rather tha copying the file to /etc/localtime. 

Also, every great once and a while the symlink might get overwritten by an update. If the clock is off I just redo the symlink

Hope this helps   :Wink: 

----------

## byebye

Thank you for answer  :Wink: 

Unfortunately, it hasn't helped.

I have the same message as you:

```
 # rc-update | grep hwclock

hwclock | boot 
```

What is interesting, when I created symlink to /usr/share/zoneinfo/Europe/Warsaw instead of copy, date and hwclock shows 15:00 (but hwclock still shows local as -2h) - BIOS time (local) is 13:00. When it is copied, date shows correct time: 13:00 and 11:00 with --utc option.

----------

## BillWho

byebye,

Maybe this will help - I get confused with all the time output options.

It's 9:59 AM here:

```
root@gentoo-gateway script # ./cktime.sh 

date ->            Sun Apr 15 09:59:04 EDT 2012

date --utc ->      Sun Apr 15 13:59:04 UTC 2012

hwclock ->         Sun 15 Apr 2012 09:59:05 AM EDT  -0.719273 seconds

hwclock --utc ->   Sun 15 Apr 2012 09:59:06 AM EDT  -1.000511 seconds

hwclock --local -> Sun 15 Apr 2012 01:59:07 PM EDT  -1.000492 seconds

```

Also, what I usually do to reset my clock if it's off is:

```
ntpdate time.apple.com
```

However, I haven't had to reset it for quite a while  :Exclamation: 

Hope this helps   :Smile: 

----------

## byebye

Hmm, I see that your hwclock also shows UTC as local and local as UTC... maybe it is correctly  :Wink: 

From my experience, time for system is the same what date shows, so I think it won't be any unexpected situations with odd time in hwclock.

Thank you BillWho  :Smile: 

----------

## BillWho

byebye,

I was banging my head against the desk for a week trying to initialize the system clock correctly during bootup. I think part of my problem was having arch, lmde and gentoo installed.

On another computer (this one) I also have windoze installed so I didn't want to have different times when each distro started. In any event, they all seem to cooperating the way I have it setup now.

I think you'll be OK with the setup I provided   :Wink: 

----------

