# [Solved] My clock don't tick correctly

## die4me

Hi.

I have a big problem. Always, if I start my PC, my clock don't tick correctly. In 8h it runs around 20minutes in the past.

When I start my PC I looks in the BIOS and there it runs correctly. If gentoo starts, it runs 20min in the past. Then izt writes the time into the BIOS. 

I have tryed with an older kernel, with a newer timezone-data and all. I don't know, what I have to do.

This is my actual kernel config and my /etc/conf.d/clock. my actual timezone-data is timezone-data-2008g-r1 and Europe/Berlin is set to /etc/localtime.

Kernelconfig: http://phpfi.com/376262

clock: http://phpfi.com/376264

And, i dont want start an ntp-client...

Thanks for your help and sry for my english... I'm german!  :Wink: Last edited by die4me on Wed Nov 12, 2008 4:34 pm; edited 1 time in total

----------

## fuzzykiller

You might want to try changing the clock source.

Add this to your kernel command line:

clocksource=hpet

Additionally, you should post the dmesg output.

----------

## die4me

I have looking for my clock source...

and this is the output: *Quote:*   

> # cat /sys/devices/system/clocksource/clocksource0/current_clocksource
> 
> hpet

  I thik it's the right.

but here my dmesg: *Quote:*   

> # dmesg
> 
> red (default)
> 
> pci 0000:01:00.0: Boot video device
> ...

 

----------

## gerard27

Hi die4me,

```

 /etc/conf.d/clock

# Set CLOCK to "UTC" if your system clock is set to UTC (also known as

# Greenwich Mean Time).  If your clock is set to the local time, then 

# set CLOCK to "local".  Note that if you dual boot with Windows, then 

# you should set it to "local".

CLOCK="local"
```

That's what I have.

Do you dual boot with Windows?If so local is the only way as it says in the comment.

Is your hardware clock set to UTC?

Gerard.

----------

## die4me

Yes, I have dual boot. But since 1 moth i haven't booted my Windows.

But I have found something, that delete this message "Clocksource tsc unstable (delta = -138984156 ns) " out of my dmesg.

I have added nohz=off to the kernel-parameters. Tomorrow I will know, if the clock works correctly. "clocksource=hpet" I also added to the kernel-parameter.

I will see and hope the clock will work correctly tomorrow... ^^

[edit]

sry...

here my dmesg again: *Quote:*   

> # dmesg
> 
> 1048576 bytes)
> 
> TCP bind hash table entries: 65536 (order: 7, 524288 bytes)
> ...

 [/edit]

----------

## die4me

hmm, I have seen it now...

It isn't working.. My clock is 20sec after the normal time... -.-

has anybody a solution?

 *Gerard van Vuuren wrote:*   

> Is your hardware clock set to UTC?

 

Sry, i have forgotten... The Hardwareclock i set to UTC

----------

## danomac

What's the output of:

```

$ zcat /proc/config.gz | grep 'NO_HZ\|HZ'

```

I have one machine that dynamic ticks doesn't work correctly and causes the clock to go out of whack. Running ntp is the easiest solution... even Windows does this against Microsoft's servers.

Also, what kind of hardware do you have? Dual-core? Quad-core?

----------

## bunder

i find this works pretty well too, providing the "system clock" is accurate:

 *Quote:*   

> CLOCK_SYSTOHC="yes"
> 
> 

 

----------

## die4me

 *danomac wrote:*   

> What's the output of:
> 
> ```
> 
> $ zcat /proc/config.gz | grep 'NO_HZ\|HZ'
> ...

 

I have a CoreDuo.

And the output of 

```

$ zcat /proc/config.gz | grep 'NO_HZ\|HZ'

```

is

```
CONFIG_NO_HZ=y

# CONFIG_HZ_100 is not set

# CONFIG_HZ_250 is not set

# CONFIG_HZ_300 is not set

CONFIG_HZ_1000=y

CONFIG_HZ=1000

# CONFIG_MACHZ_WDT is not set
```

[edit]

should I disable this feature??

[/edit]

----------

## danomac

 *die4me wrote:*   

> should I disable this feature??

 

I wanted to see if you had the same kernel config that I had troubles with, and it looks like you do...

On my problem machine I disabled Dynamic Ticks in the kernel and set the timer frequency to 100Hz. That solved the problem that I had; I don't know if it will help you. I think it just depends on the board...

Both of these options are under Processor type and features.

```

Processor type and features  --->

   [ ] Tickless System (Dynamic Ticks)

       Timer frequency (100 HZ)  --->

```

I've read through mailing lists that by increasing the timer frequency it can help a slow clock drift.

If that fails you will have to use ntp-client or something to keep your clock in check. Windows does this automatically as well...

----------

## die4me

I have seen this too...

In a kernel config of a friend.

It is changed in my kernel since 30minutes and the clock has no off time...

But I will look tomorrow after work.

But thanks a lot!  :Wink: 

----------

## die4me

Thanks.

It is working correctly.

My clock has now no off time! ^^

----------

