The system clock on my dedicated server is running too slow. Every month it loses about 2 minutes.
The details are: Cent OS, Linux version 2.6.9.
How can I resolve the problem, is there any way to check whether it's a hardware or software?
You can resolve the problem by running NTP. If it isn't already installed you should be able to do something like
yum install ntp chkconfig --levels 235 ntpd on service ntpd start
You may have to give it a while to sync the first time.
2 minutes a month isn't too bad. NTP should be able to happily correct that amount of drift.
If it hasn't always been this way and you're able to take the machine down, then try replacing the CMOS battery. They're cheap and you might find that it resolves the issue.
Anecdotal story for you:
I have in the past seen a running machine which was exhibiting 500~ PPM drift. Equating to about 45 seconds a day. It was far too much for NTP to correct on-the-fly. I tried all kind of things to fix it including a new kernel and different RTC classes.
At my wits' end, and against the logic that it should affect a running machine, I replaced the CMOS battery with a fresh one. A multi-meter showed only a very small difference between the old and new batteries. It fixed the clock drift.
The easiest way to get round the problem is to have your server sync regularly with an NTP time source, this way it should get corrected quickly if it starts to drift.
If you are not using NTP then your computer will be relying on the internal clock. If this is losing time it's often a hardware issue, either with the clock itself, BIOS, or the CMOS battery (although this should be less of an issue if it is not restarted often).