LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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.

Notices


Reply
  Search this Thread
Old 04-12-2004, 05:01 PM   #1
Spudley
Member
 
Registered: Mar 2003
Location: Berkshire, England.
Distribution: SuSE 10.0
Posts: 299

Rep: Reputation: 32
Linux clock losing time


Hi,

I've got a fairly new PC running SuSE 9.0. Everything runs okay, but I'm a bit worried because the clock seems to be losing time quite badly.

I haven't worked out if it's consistent, but it seems to lose more than a minute in every hour. I've had the machine on all day today, and it's lost more than a quarter of an hour.

It isn't a hardware problem, because it keeps perfect time when it's switched off, so it must be something funny going in Linux, or at least in something I'm running.

Does anyone have any ideas? Is there anything obvious I should be looking at?

Thanks for any advice.

Quick rundown of the setup:
Processor: AMD3000
Mobo: Asus A7N8X-E Deluxe
Ram: 1gig
SuSE is the only OS installed on the machine; it was a fresh install with nothing else on the system. I'm using it as a desktop system, running KDE.
 
Old 04-12-2004, 05:14 PM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
I would check 'top' and see how heavily loaded your CPU is. If the percentage is high it might be the problem and 'top' will show you which program might be causing the high system load.
 
Old 04-12-2004, 06:06 PM   #3
Andrew Benton
Senior Member
 
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
Have a look at /var/log/syslog and see if there are any error messages that might give you some clues.
 
Old 04-12-2004, 06:38 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 16,036

Rep: Reputation: 1853Reputation: 1853Reputation: 1853Reputation: 1853Reputation: 1853Reputation: 1853Reputation: 1853Reputation: 1853Reputation: 1853Reputation: 1853Reputation: 1853
There are two clocks. The Real Time Clock is an integrated chip on the motherboard that keeps time when the PC is turned off. Once the system is booted the clock is actually a kernel timer which is synched from the RTC. I'm not positive how the OS determines the frequency but it is adjustable. Might want to do some more seraching on the web.

http://gd.tuwien.ac.at/linuxcommand....adjtimex8.html
 
Old 04-12-2004, 06:54 PM   #5
hallamigo
Member
 
Registered: Feb 2004
Location: Utah, USA
Distribution: Debian
Posts: 230

Rep: Reputation: 31
I had this same issue with my laptop and the battery status icon - oddly having that turned on was effecting the time similar to your issue. Being that you're on a PC and don't have a battery I'm guessing it must be something similar to the battery icon (system monitor, some other app)?
 
Old 04-13-2004, 02:56 AM   #6
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 85
Also, check out: man hwclock

There are a variety of options to set the system clock (displayed on your desktop) to equal the hardware clock (basically the BIOS system time), or vice versa. -- J.W.
 
Old 04-13-2004, 03:08 PM   #7
ekman
Member
 
Registered: Apr 2004
Location: Sweden
Posts: 41

Rep: Reputation: 15
Hello,
Check if you have the NTP (Network Time Protocol) daemon running, it is called
"xntpd" on SuSE I think. If so, either turn it off, or (preferably) configure it to
syncronize the clock with some external ntp server.
/L Ekman
 
Old 04-14-2004, 06:42 PM   #8
Spudley
Member
 
Registered: Mar 2003
Location: Berkshire, England.
Distribution: SuSE 10.0
Posts: 299

Original Poster
Rep: Reputation: 32
Firstly, thanks for all the replies.

Now, to answer them.......

Quote:
Originally posted by itsme86
I would check 'top' and see how heavily loaded your CPU is.
It isn't heavy usage. I've been running top as well as ksysguard; nothing special to report there... and in any case, I'm certainly not doing anything more strenuous than I have done on other machines without this problem.

Quote:
Originally posted by Andrew Benton
Have a look at /var/log/syslog and see if there are any error messages that might give you some clues.
There isn't one. (does this mean I haven't had any system errors since I installed? yay! )

Quote:
Originally posted by michaelk
There are two clocks. The Real Time Clock is an integrated chip on the motherboard that keeps time when the PC is turned off. Once the system is booted the clock is actually a kernel timer which is synched from the RTC....
Thanks - interesting link. I was aware of this (at the user level), because when I reset the clock after it's lost time, it sometime jumps back to the right time when it loads the setup program, without me having to actually make the change. I guessed it was resetting from the hardware clock, and that made sense since it was keeping time when switched off.

It still doesn't answer the real question, which is why the OS clock seems to have trouble keeping up with the hardware clock.

Quote:
Originally posted by hallamigo
I had this same issue with my laptop and the battery status icon - oddly having that turned on was effecting the time similar to your issue. Being that you're on a PC and don't have a battery I'm guessing it must be something similar to the battery icon (system monitor, some other app)?
I would be inclined to believe there is a program causing this, but I have no idea what. It's been happening since day one when I got the PC and installed SuSE (although I only noticed it after a week when I suddenly realised the clock was three hours out), and the only apps I can think I that I've been running consistently all that time would be Konqeror and Kmail (along with the usual suspects in the background processes list - basically the SuSE default plus spamd). And they certainly shouldn't be causing this. Other programs have been used, but I'm still bedding this machine in, so I've been chopping and changing quite a lot - nothing else has been running consistently enough to have been doing this.

Quote:
Originally posted by J.W.
Also, check out: man hwclock
I will do. Thank you.

Quote:
Originally posted by ekman
Hello,
Check if you have the NTP (Network Time Protocol) daemon running, it is called
"xntpd" on SuSE I think.
Worth a thought, but I did check that - NTP is definitely switched off.


Thanks again for all the ideas.

I still don't really have an answer to this, though. There were a couple of ideas here on how I might get around it by using the hardware clock, but I would like to get to the root of the problem, and find out *why* it's happening, because I have a feeling it might be causing other problems (I have noticed some speed problems on this system on the odd occasion, even though it's far more powerful than my older machine. And I don't like having that nagging feeling that I might've messed something up somewhere in the setup.

Any more ideas?
 
Old 04-27-2004, 07:21 PM   #9
snwright
Member
 
Registered: Feb 2004
Location: long island ny
Distribution: fedora core 1
Posts: 35

Rep: Reputation: 15
Quote:
Originally posted by itsme86
I would check 'top' and see how heavily loaded your CPU is. If the percentage is high it might be the problem and 'top' will show you which program might be causing the high system load.
itsme, or anybody:
i have this exact problem. my machine runs fine, but whenever i burn a cd and use lame and cdrdao, my cpu load goes through the roof and my clock starts losing time. i estimate i can lose up to about 5 minutes per hour when decoding & burning cds constantly. is there any way that i can remedy this problem without ceasing to burn & encode or buying new hardware?
thanks,
spencer
 
Old 04-27-2004, 09:58 PM   #10
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,891

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
You might also look into chrony-1.20. It's an atomic clock synchronization utility which references the same NTP sources. But, it's intended for intermittent internet connections, though it will work with a continuous connection. It keeps your clock in sync with an atomic clock. The daemon watches for an internet connection, then goes to work. It also maintains a drift-rate file which it uses to estimate the rate at which your system clock drifts from the atomic clock. The client is a command-line utility used to configure chrony. Better than a wrist watch, eh?

Last edited by bigrigdriver; 04-27-2004 at 10:01 PM.
 
Old 11-30-2004, 03:37 PM   #11
ajarlow
LQ Newbie
 
Registered: Nov 2004
Posts: 3

Rep: Reputation: 0
I also had this problem and found J.W.'s response helpful, namely:

man hwclock

Whenever you set the time using hwclock it writes /etc/adjtime. Amongst other things, this file records the time that you last set the clock along with the systematic clock drift rate (i.e. the number of seconds per day by which the hardware clock loses or gains time), calculated using the time you last set the clock. The clock drift rate recorded in adjtime is used to adjust the hardware clock. When I looked at my adjtime file, it had quite a large number for the clock drift rate which caused my screen clock to lose time quite heavily. The hwclock man page just talks about adjustment of the hardware clock, not the screen clock, however I tried setting the clock drift rate (the first number in the adjtime file) so that the clock gained rather than lost ten minutes per day and found that my screen clock stopped losing time and started gaining ten minutes per day. I don't think my screen clock is running off the hardware clock because when I reset my hardware clock (using hwclock) the screen clock did not reset. Nevertheless, the screen clock seems to adjust itself using the clock drift rate in adjtime.

To fix this either set the clock drift rate to zero, delete the adjtime file and reset the screen clock or calculate the correct value for the clock drift rate. I did the last of these by deleting the adjtime file, then setting the hardware clock using:

hwclock --set --date="7/22/01 17:45:05" (or whatever the date/time was at the time)

This wrote a new adjtime file without a clock drift rate in it. A few days later I reset the hardware clock again, which updated the adjtime file with the newly calculated clock drift rate. Since my screen clock does not seem to run off the hardware clock, I had to reset that as well. But my screen clock has worked OK since then.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Various clock issues: Clock shows wrong time only in Knoppmyth, & CMOS time change ? davidbix General 1 04-05-2006 09:58 PM
ipw2200 losing connection all the time (urgently desperate) Nightfrost Linux - Wireless Networking 14 05-17-2005 04:16 AM
losing too many ticks, and system time h/w Linux - Hardware 6 06-15-2004 08:16 PM
Clock keeps going out of time linksocc Linux - General 10 10-01-2003 08:05 AM
time clock jimval7 Linux - Distributions 2 03-21-2002 03:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration