# Computer Clock is allways late [Broken again =/ ]

## Maragato

Since ive installed 2005.1 on my box my clock is allways late doesnt matter how many times I check it. Ive looked on the reported bug and found nothing that matches with my problem. 

here is the output of emerge --info that was requested on bug reports.

```
Version 1.6.12

dev-lang/python:     2.3.5

sys-apps/sandbox:    1.2.11

sys-devel/autoconf:  2.13, 2.59-r6

sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.5

sys-devel/binutils:  2.15.92.0.2-r10

sys-devel/libtool:   1.5.18-r1

virtual/os-headers:  2.6.11-r2

ACCEPT_KEYWORDS="x86"

AUTOCLEAN="yes"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-O2 -march=athlon-xp -pipe -fomit-frame-pointer"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/qmail/control"

CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"

CXXFLAGS="-O2 -march=athlon-xp -pipe -fomit-frame-pointer"

DISTDIR="/usr/portage/distfiles"

FEATURES="autoconfig distlocks sandbox sfperms strict"

GENTOO_MIRRORS="http://ftp.linux.ee/pub/gentoo/distfiles/ http://gentoo.mirrors.easynews.com/linux/gentoo/ ftp://gentoo.ccccom.com http://gentoo.ccccom.com"

MAKEOPTS="-j2"

PKGDIR="/usr/portage/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

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

USE="x86 X alsa apm arts avi berkdb bitmap-fonts crypt cups curl eds emboss encode esd fam foomaticdb fortran gdbm gif gnome gpm gstreamer gtk gtk2 imlib ipv6 jpeg kde libg++ libwww mad mikmod motif mp3 mpeg ncurses nls ogg oggvorbis opengl oss pam pdflib perl png python qt quicktime readline sdl spell ssl tcpd tiff truetype truetype-fonts type1-fonts vorbis xml2 xmms xv zlib userland_GNU kernel_linux elibc_glibc"

Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTDIR_OVERLAY

```

Ah im not having such problems in windows and the pc battery is new.Last edited by Maragato on Sun Nov 06, 2005 1:07 am; edited 2 times in total

----------

## nanoczar

How different is the time?  I recently had this problem because Windoze made my timezone different and caused the shift in time.  (Shift in time...rather funny).  Make sure your BIOS time is correct, then make sure Windoze is right.  Then boot into gentoo.  If your gentoo system is borking your time then you need to set /etc/localtime (see the install docs).

Why do we continue to dual boot?   :Smile:   Must be for the torture.   :Wink: 

-nanoczar

----------

## Maragato

 *nanoczar wrote:*   

> How different is the time?  I recently had this problem because Windoze made my timezone different and caused the shift in time.  (Shift in time...rather funny).  Make sure your BIOS time is correct, then make sure Windoze is right.  Then boot into gentoo.  If your gentoo system is borking your time then you need to set /etc/localtime (see the install docs).
> 
> Why do we continue to dual boot?    Must be for the torture.  
> 
> -nanoczar

 

Windows time is right bios too, the problem is just with gentoo.

----------

## jmja89

Sometimes if DMA is not enabled on your harddrive(s) you will get clock drift. Perhaps that is the problem.

----------

## nanoczar

So is there a constant difference or a drift?  I too have seen both but it has been a while...

----------

## Maragato

 *nanoczar wrote:*   

> So is there a constant difference or a drift?  I too have seen both but it has been a while...

 

It is a drift, how do I check if I got dma enabled?

----------

## jmja89

```
/sbin/hdparm /dev/hda
```

 and see if dma is on.

----------

## Maragato

 *jmja89 wrote:*   

> Sometimes if DMA is not enabled on your harddrive(s) you will get clock drift. Perhaps that is the problem.

 

Oki I think DMA is disabled, how can I fix it?

```
/dev/hda:

 Model=Maxtor 6E040L0, FwRev=NAR61590, SerialNo=E167SDNE

 Config={ Fixed }

 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=57

 BuffType=DualPortCache, BuffSize=2048kB, MaxMultSect=16, MultSect=16

 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=80293248

 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}

 PIO modes:  pio0 pio1 pio2 pio3 pio4 

 DMA modes:  mdma0 mdma1 mdma2 

 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5 udma6 

 AdvancedPM=yes: disabled (255) WriteCache=enabled

 Drive conforms to: (null): 

 * signifies the current active mode

```

----------

## rdk

```
/sbin/hdparm -d 1 /dev/hdX

```

where X is a letter of you hard disk.

----------

## Maragato

Done:

```

/dev/hda:

 setting using_dma to 1 (on)

 HDIO_SET_DMA failed: Operation not permitted

 using_dma    =  0 (off)
```

----------

## NeddySeagoon

Maragato,

You have a piece missing from your kernel - the chipset driver for your IDE chiip.

----------

## NeddySeagoon

Maragato,

In make menuconfig navigate

```
Device Drivers

ATA/ATAPI/MFM/RLL support (IDE)

Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support (BLK_DEV_IDE)

PCI IDE chipset support (BLK_DEV_IDEPCI)

Use PCI DMA by default when available (IDEDMA_PCI_AUTO)

SiS5513 chipset support (BLK_DEV_SIS5513)
```

and turn on the last item as built in.

Now recompile and reinstall your kernel.

----------

## darkphader

Also note that Windows runs a time service (sntp) by default. Are you running ntpd or openntpd under Gentoo?

----------

## opqdan

If the difference in time is constant (ie, a constant number of hours, probably equal to the change due to your time zone) then the problem is windows.  Windows will reset the computers time to be its local time, causing Linux confusion when it thinks the computer is set to GMT.  Just change the setting to LOCAL.

in /etc/conf.d/clock change

```
CLOCK="UTC"
```

to

```
CLOCK="local"
```

----------

## Maragato

I had to recompile the kernel, it was a DMA problem. Thanks guys specially neddy who helped me via irc too.  :Smile: 

----------

## Maragato

Guys Im having this very same problem again after a world update Ive checked all your comments but got no idea why clocks is drifting, dma is on since I havent touched the kernel. any ideas?

----------

