Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I am using Debian / knoppix 3.4 on a laptop. Linux kernel 2.4.26.
My Hardware Clock is accurate. My System Time syncs to the (correct) Hardware Clock setting when I start the computer, but then quickly starts losing time. The System Time seems to be about 15 minutes slower by the end of the day.
Again, the Hardware Clock (time kept by CMOS) is OK. It is the System Time (kep t by the kernel) that is wrong.
Why is this happening? How can I get the kernel to keep accurate time?
this is confusing cause as i understand it the kernel uses time stamp counter (hardware)
not real-time clock (software) so there are no interupts thus no latency ????????
this should mean the clock should be rock solid.
what kind of cpu is this ????
I beleive I have solved the problem. The System Time is calibrated with a program called adjtimex, which I didnt have installed.
After installing adjtimex, I have configured it to run in the startup scripts and calibrated it to adjust the System Time to run at the correct speed. See man adjtimex(8) for details.
This is the right solution; the kernel now keeps correct time. Syncing hourly to the hardware clock would have been a poor solution; the time would have been inaccurate betwen syncs, and in addition it is bad form to change the System Time in a running system as this can cause problems with other processes running on the system.
Using ntpd was not an option in this case since the machine is only intermitantly connected to the net.
Thanks for the various suggestions. Just wanted to update the thread with the latest on my System Time issues.
Using adjtimex, I was able to set up the kernel's time variables more accurately. This has got system time to be much more accurate... now it's off by usually 8-10 seconds a day rather than 8-10 minutes.
I haven't been able to get it to run more accurately than that; the remaining variance seems to be irreguar, sometimes fast sometimes slow. Also note that adjtimex --compare produces wildly innaccurate and inconsisten results on my system. These problems may be due to apmd, which I am running (I use apm because acpi caused more serious problems on my system). Some other people seem to think it could be the battery monitor application. Some more information on laptop time problems under linux is discussed here:
Setting up ntpd and a script to run it when possible as trickykid suggested might be the best solution for the remaining innaccuracy. I may work on this when I have more time. Really though, if apmd is at fault the program should be fixed.
Originally posted by monkeyman2000 The CPU is a Pentium III. Not sure what difference that would make.
the interplay between kernel and cpu is all the difference there is
Time-stamp counter measures cpu cycles and not "time". For example, two hundred million cycles on a 200 MHz processor is equivalent to one second of real time, while the same number of cycles on a 400 MHz processor is only one-half second of real time. Thus faster proccessor has finer grained time accuracy
access is through model specific registers.. Intel started making it available for programmers
Intel chips have 2 registers AMD chips have 4 some cyrix chips dont do RDTSC some do even as they all identify themselves to the kernel as i686 each chip is handled differently and |o| sometimes the kernel has buggs. (i can't believe i said that)
from the kernel mailing list concerning this subject:
Some web pages say "Works Best with IE 4.0"
Linux will have to say "Works Best with Intel Inside!".
add to this mix the fact that linux people generally are running kernels compiled specifically to run on intel cpus manufactured in 1980 for some strange reason.
If the processor does not have Time-stamp counter available then the kernel will have to use interupts that can well -- get interupted.