# System time always slow

## David_r

Hi I wasn't sure where to put this one, the RTC in the box keeps time just fine however the system time is always out, it loses about 10 minutes every hour.

If i leave it for 12 hours then come back its way out. The RTC has the right time but the system time is about 2 - 3 hours out, I've even taken to syncing the system time every hour with various different time servers but it's still no good.

Anyone have any ideas because I'm pretty stumped, I've never seen anything like this before.

David.

----------

## fctk

http://gentoo-wiki.com/HOWTO_NTP

----------

## lwithers

This probably indicates that the battery voltage on your motherboard is too low. Try replacing the battery.

And the best solution is to use chrony, not NTP, simply because NTP is a PITA to set up and use. Simply:

```
emerge chrony

rc-update add chronyd default

nano /etc/chrony/chrony.conf
```

and set up the configuration file. You probably want something like this:

```
# NTP servers

server a.ntp.alphazed.net

server bear.zoo.bt.co.uk

server ntp.cis.strath.ac.uk

server ntp2a.mcc.ac.uk

server time-server.ndo.com

server ntp0.sandvika.net

server ntp2b.mcc.ac.uk

server ntp2c.mcc.ac.uk

server ntp2d.mcc.ac.uk

server ntp1.sandvika.net

server ntp2.sandvika.net

# if we are more than 30 seconds out, jump to new time rather

# than changing there gradually

initstepslew 30 ntp0.sandvika.net

# Only allow connections from localhost

allow 127.0.0.1

# Only allow commands to be issued from localhost

cmdallow 127.0.0.1

# Measurement files

driftfile /var/lib/chrony.drift

dumpdir /var/lib/chrony

dumponexit

rtcfile /var/lib/chrony.rtc

# Log all changes of over 0.5 seconds to syslog

logchange 0.5

# Use UTC in the real-time clock

#  (only use this if you store UTC, no good if you dual boot

#  with windows)

rtconutc

```

Those NTP servers are for the UK; the Gentoo Wiki has a link to the page detailing where to find servers. Once done, you can start it up straight away with "/etc/init.d/chronyd start". The manual is very good as well.

----------

## David_r

I already use NTP, and i don't see how it can have anything to do with the voltage as the RTC as its always accurate, it's the system time that's off. Not just a little bit off it loses about 10 - 20 minutes every hour. So syncing the system time does me no good at all, unless I update it every 5 minutes.

If i boot the system into slack (second HD I have no time problems)

RTC is fine, MB is brand new it can't be hardware, RTC keeps perfect time. Boot into a different OS and it keeps perfect time.

Right now my system time is 15:50 my RTC says 16:01 they were both synched together less than an hour ago the RTC is accurate it always is system time has dropped 11 minutes in the last 50  :Sad: 

David.

----------

## fctk

maybe your hard disk(s) DMA is not enabled...

----------

## David_r

hdparm -i /dev/hda:

 UDMA modes: udma0 udma1 *udma2 udma3 udma4 udma5

 * signifies the current active mode

Why would my HD's DMA setting affect my system time?

David

----------

## pjp

Moved from Installing Gentoo.

----------

## David_r

Thanks wasn't sure where this one belonged it doesn't appear to be a hardware problem as the RTC is fine and its fine with another OS could be the kernel I just don't know  :Sad: 

David.

----------

## fctk

try this:

```
# hdparm /dev/hda | grep using_dma
```

----------

## David_r

DMA is off on the drive but I still don't see how this would affect system time?

Can you enlightenment me.

David

----------

## fctk

i had a similar problem and i solved it by enabling dma. anyway, enabling dma is also good for speeding up your hard disk... i really think you should try enabling it.

if you want to do so, you probably have to recompile your kernel with southbridge chipset support (see your motherboard specs)...

----------

## David_r

Enabling DMA on the drive didn't work, thanks for the tip, although I'm not sure how it would effect system time.

In fact I can't see how the system time can be so screwed when the RTC is always fine  :Sad: 

----------

## iandow

I'm having the same problem.  I use ntpdate to set my time, then start ntpd.  But overnight, but clock goes off by an hour or more, again.  My ntpd.conf is the same as it was on redhat, so I'm pretty sure the problem is not in there.  I should be getting my time synced from the ntp server specified in ntpd.conf, but it doesn't look like that's happening.

-ian

----------

## David_r

I did solve the problem in the end.

I had to recompile the kernel with the correct support for my motherboard. Time problem solved itself at that point.

Thanks to everyone for the help.

David.

----------

## nobrob

I have this same problem, but I've recompiled my kernel with my motherboard's module (yes, DMA works now), and my system clock is still slow...  :Sad: 

----------

## fctk

do you dual-boot? if yes, is windows the other os?

and... you can check if your mobo battery is full or not...

----------

## charlieg

My system time is always an hour behind.  I've tried setting $CLOCK (in rc.conf) to local, BST, GMT, UTC, anything.  I can't escape this dreaded hour lapse.  WHY MEEEEEEEE!!!!!!?????? BBWWWHAAAAAHAHAHA!!!!!!!

edit: Sheeeet.  Forgot to say that I use ntp-client, as per the tutorial.

----------

## nobrob

My battery must be fine... when my computer's off it doesn't lose time  :Sad: 

I actually think it's ok now, having the NTPd running, it seems to sync it ok that DMA is enabled, although without NTPd it would desync loads (without DMA I don't think NTPd does anything).

I do have the problem of having my time one hour behind, because of daylight saving time... NTPd sets the time to the default GMT time, and doesn't compensate the one hour time difference for daylight saving... I'll have to look into that  :Very Happy: 

Thanks for the help, I would have never thought of enabling DMA to fix my clock... but it's worked out really useful (Gentoo runs much much MUCH faster  :Very Happy:  :Very Happy: )

----------

## nobrob

charlieg: set your zoneinfo to zoneinfo/Europe/London  :Smile:  that compensates for the daylight saving changes. UTC, GMT and BST don't.

Do this:

```
ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime
```

----------

## charlieg

 *nobrob wrote:*   

> charlieg: set your zoneinfo to zoneinfo/Europe/London  that compensates for the daylight saving changes. UTC, GMT and BST don't.
> 
> Do this:
> 
> ```
> ...

 

That really should be in the wiki.

----------

## ChojinDSL

Actually that is in the gentoo "Localisation" howto.

----------

## charlieg

 *ChojinDSL wrote:*   

> Actually that is in the gentoo "Localisation" howto.

 

Regardless, it should be a note in the ntp howto about how to get the correct local time by first following the Localisation howto.

----------

