Matthias-Christian Ott wrote:
nx wrote:

On Mon, 16 May 2005 21:33:47 +0800, Matthias-Christian Ott <[EMAIL PROTECTED]> wrote:

David Helstroom wrote:

Hi nx,
I'm not sure if this is the problem, but you may need to load the Real
Time Clock (RTC) module if it is available. To do this, run:
# modprobe rtc
This should load the RTC module on the standard Arch 2.6 kernels. To get
this module to load on boot, don't forget to add it to the MODULES line
in /etc/rc.conf.
Hope that helps,
Dave.
On Mon, 2005-05-16 at 20:02 +0800, nx wrote:


I find that my linux box's time always runs faster than real time.

This is the trouble:
[EMAIL PROTECTED] ~]$ LANG=C uptime
 19:17:58 up 3 days, 23:44,  1 user,  load average: 0.27, 0.21, 0.24
[EMAIL PROTECTED] ~]$ LANG=C date
Mon May 16 19:18:17 CST 2005
[EMAIL PROTECTED] ~]$ LANG=C hwclock
Mon May 16 18:59:42 2005  -0.271290 seconds

I double checked the 2 time with other clocks, the hwclock is accurate. The system clock gets about 18.5 minutes faster after 3 day running.

I noticed this problem several days ago.And I have googled about it, an article saying kernel timer 3 times faster. But its solution seems not suitable for me.

And I have checked that, it does not exist when kernel is 2.4.xx version.
It must be a kernel related problem, now I am using 2.6.11.7 kernel for that 18.5 minutes faster after 3 day.
Knoppix 3.8.1, slax 5.0.x get same result: system get 2-3 minutes faster after 6-8 hour running.


I have tried to address down the problem, but it seems to hard for an average user.
I think it's adjtimx's job to control the system clock's speed. But I can not figure out what parameters to give. And arch linux does not provide it.
Or more directly, the system clock speed is reflected from one of the files in /proc/sys or /sys, maybe that clock's speed can be tuned by write a number into a file there. /proc/sys/dev/rtc/max-user-freq and /sys/block/hda/queue/iosched/est_time may be. But I am not sure of their meaning. /sys/devices/system/timer/timer0 is an empty directory, then what is it for?



Have a look at the strace of both programs:
date does the realtime clock system calls directly.
hwclock uses /dev/rtc.
Maybe this is the problem if the /dev/rtc interface does not exist.



I checked strace's output and date.c,gettime.c from coreutils, date gets time using
int clock_gettime(clockid_t clock_id, struct timespec *tp);


hwclock gets time by read /dev/rtc

Where will clock_gettime get time from?

_______________________________________________
arch mailing list
[email protected]
http://www.archlinux.org/mailman/listinfo/arch

/dev/rtc uses the CMOS clock (include/asm-generic/rtc.h).
I don't know what clock_gettime uses (I lost the trace kernel/posix-timers.c), maybe it uses the pit timer (http://translate.google.com/translate?u=http%3A%2F%2Fcommunity.osdev.info%2F&langpair=ja%7Cen&hl=en&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools) (I think so). The Kernel is so bad coded :). Try to use the hpet timer in your kernel config and see if it's right then. The Kernel uses some algorithms to correct the pit timer time because it's not exactly 100Hz (maybe your pit is a bit buggy or so).


Matthias-Christian Ott

That's the right link:
http://translate.google.com/translate?u=http%3A%2F%2Fcommunity.osdev.info%2F&langpair=ja%7Cen&hl=en&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools

_______________________________________________
arch mailing list
[email protected]
http://www.archlinux.org/mailman/listinfo/arch

Reply via email to