# Clock is getting switched 2 hours forward every boot[SOLVED]

## crazycat

Everytime i boot, my clock is 2 hours forward. It also doesn't matter if I correct it with "ntpdate pool.ntp.org" or leave it as it is. I use "local" time for dual-booting. I removed /etc/adjtime - didn't help.

Renaming hwclock didn't help also. Also somewhere "clock" is marked as essential service which it isn't  and i can't just remove it.  Also my time zone is CEST - thats 2 hours forward from GMT.  

Anyone any idea how to fix that?

My hardware description is in my signature.

That's my make.conf:

```

LINGUAS="en_US de"

USE="7zip X a52 aac acpi adplug adsl alsa ao audiowizard bash-completion

     bittorrent bzip2 cdr chardet chm cjk d daemon dbus disk-partition djvu

     dts dvd dvdr dvdread encode extensions fam fat ffmpeg flac fluidsynth

     gcrypt geoip gif gimp glitz gnustep gnutls gstreamer gtk hal hfs ieee1394

     imlib inherit-graph jfs joystick jpeg kde kpoll kqemu lame lcms libwww

     lm_sensors mad matroska mikmod mjpeg mmap mmx mmxext mng mod modplug mp3

     mp4 mpeg multicall musepack networkmanager ntfs nvidia objc ogg openal

     opengl pch pdf png qt3 qt3support qt4 quicktime rar reiser4 reiserfs rtc

     rtsp scanner scenarios sdl sid slang smi smp sndfile sourceview sqlite

     sqlite3 srt sse sse2 sse3 ssse3 subversion svg tga theora threads tiff

     timidity truetype tta usb v4l2 valgrind vnc vorbis vorbis-psy wav wavpack

     wideband win32codecs wma wxwindows x264 xattr xcb xcomposite xfs xiph

     xscreensaver xv xvid xvmc -acl -bitmap-fonts -cli -dri -fortran -gdbm

     -gnome -ipv6 -multitarget -perl -reflection -spl"

MULTITARGET="i686 avr arm"

VIDEO_CARDS="vesa nv nvidia"

ALSA_CARDS="emu10k1"

INPUT_DEVICES="evdev joystick"

CHOST="i686-pc-linux-gnu"

CFLAGS="-march=native -O2 -pipe"

CXXFLAGS="${CFLAGS}"

MAKEOPTS="-j5"

ACCEPT_KEYWORDS="~x86"

#PORTDIR=/usr/portage

PORTAGE_TMPDIR=/tmp/portage

PORTDIR_OVERLAY=/usr/local/portage

DISTDIR=/tmp/distfiles

PORTAGE_NICENESS=20

SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"

FEATURES="userfetch userpriv parallel-fetch sandbox"

```

lspci

```

00:00.0 Host bridge: ATI Technologies Inc Device 7930

00:02.0 PCI bridge: ATI Technologies Inc Device 7933

00:05.0 PCI bridge: ATI Technologies Inc Device 7935

00:06.0 PCI bridge: ATI Technologies Inc Device 7936

00:12.0 SATA controller: ATI Technologies Inc SB600 Non-Raid-5 SATA

00:13.0 USB Controller: ATI Technologies Inc SB600 USB (OHCI0)

00:13.1 USB Controller: ATI Technologies Inc SB600 USB (OHCI1)

00:13.2 USB Controller: ATI Technologies Inc SB600 USB (OHCI2)

00:13.3 USB Controller: ATI Technologies Inc SB600 USB (OHCI3)

00:13.4 USB Controller: ATI Technologies Inc SB600 USB (OHCI4)

00:13.5 USB Controller: ATI Technologies Inc SB600 USB Controller (EHCI)

00:14.0 SMBus: ATI Technologies Inc SB600 SMBus (rev 13)

00:14.1 IDE interface: ATI Technologies Inc SB600 IDE

00:14.3 ISA bridge: ATI Technologies Inc SB600 PCI to LPC Bridge

00:14.4 PCI bridge: ATI Technologies Inc SB600 PCI to PCI Bridge

01:00.0 VGA compatible controller: nVidia Corporation G72 [GeForce 7300 SE] (rev a1)

02:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8052 PCI-E ASF Gigabit Ethernet Controller (rev 20)

03:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8053 PCI-E Gigabit Ethernet Controller (rev 22)

04:07.0 Multimedia audio controller: Creative Labs SB Audigy (rev 03)

04:07.1 Input device controller: Creative Labs SB Audigy Game Port (rev 03)

04:07.2 FireWire (IEEE 1394): Creative Labs SB Audigy FireWire Port

04:08.0 RAID bus controller: Promise Technology, Inc. PDC40719 [FastTrak TX4300/TX4310] (rev 02)

```

Last edited by crazycat on Sun Jun 15, 2008 2:59 pm; edited 1 time in total

----------

## FrankRizz0

Have you checked your bios yet?  It might not be a poblem with Gentoo, it could be a hardware problem.

----------

## Vlad

I would have suggested doing 

```
# /sbin/hwclock --systohc

```

But yeah, could be a BIOS thing.

----------

## crazycat

Windows works fine. It shows corret time, no matter if I run "ntpdate pool.ntp.org" from gentoo or leave it as it is. It worked fine a pair of months ago. It has something to do with new clock initialization or something. Maybe some kernel option. I have /dev/rtc enabled in kernel and hpet, but if I enable hpet in bios, pc hangs at boot just after it registers shedulers.

----------

## harrisonmetz

When you say you use "local" you mean that In /etc/conf.d/clock you have:

```
CLOCK="local"
```

In addition, you have your timezone in that file too

```
TIMEZONE="America/Chicago"
```

Is this correct?

----------

## crazycat

My /etc/init.d/clock was empty. I added CLOCK and TIMEZONE , rebooted, still got this annoyng +2 hours offset. Now if I run "date", i get 

```
"Sun Jun 15 18:18:39 CEST 2008"
```

If I run "hwclock --localtime", i get 

```
"Sun 15 Jun 2008 04:18:43 PM CEST  -0.605253 seconds".
```

So do I have to run "hwclock --hctosys" ("set the system time from the hardware clock")  each boot now?

I wonder why it isn't run automatically or is there an error somewhere?

----------

## harrisonmetz

No, not your /etc/init.d/clock your /etc/conf.d/clock file. Can you post that?

----------

## crazycat

Yeah, I meant /etc/conf.d/clock, just typed wrong. Now it has

```

CLOCK="local"

TIMEZONE="Europe/Berlin"

```

I rebooted with that but that didn't help. I put now "/sbin/hwclock --systohc" to /etc/conf.d/local.start and it now kind of works.

----------

## ganderatc

Whenever you modify your /etc/conf.d/clock, you should re-emerge timezone-data for it to take effect. Also, if you have /etc/init.d/clock in your startup list, you shouldn't have to run hwclock in local.start.

----------

## crazycat

I tried to remove clock service many times as I first encountered this problem but couldn't, it was automatically readded because it was essential service or something. Now i discoverde that it's not run at all. I'm gonna try it out now and post results.

EDIT: same thing. clock service doesn't seem to do anything. 

if i try to manually start/restart clock service it i get this:

```

/etc/init.d/clock: line 12: is_uml_sys: command not found

/etc/init.d/clock: line 15: is_vserver_sys: command not found

/etc/init.d/clock: line 18: is_xenU_sys: command not found

/etc/init.d/clock: line 21: is_vz_sys: command not found

 * Setting system clock using the hardware clock [Local Time] ...                                                      

```

I think this 2 hours offset is something the kernel does, I just have to restore system clock from hardware clock. I wonder why other people dont have this kind of problem. Maybe I've got it because I use some arcane hardware (ati rd600 board with a core2quad).

----------

## zyko

 *Quote:*   

> I wonder why other people dont have this kind of problem.

 

Well, I have observed this problem on my laptop, but not on my desktop or server. Those three machines use the same timezone, hwclock is set correctly, etc... I don't have the slightest clue what might be wrong.

I just went ahead and set timezone to UTC on my laptop, which shows the correct time (namely UTC+1, +1 for summer time). *shrug*

----------

