[CentOS] system clock

Kwan Lowe kwan.lowe at gmail.com
Mon Feb 7 00:56:24 UTC 2011


On Sun, Feb 6, 2011 at 4:35 PM, Buz Davis <buzdavis at earthlink.net> wrote:
> I am running CntOS 5 with Gnome.  Every  now and then I have noticed
> that the computer will somehow get the time wrong by several hours.  Is
> there a simple way to adjust the time?  So far the only way I have found
> is to boot into windows (it is a dual boot system), make the change
> there, and then get back into CentOS.  Older versions of Red Hat and
> Fedora let you do it by right-clicking on the time display, if I recall
> correctly, but setting the time isn't one of the options in CentOS.

To summarize what others have said:

1) The disparity is caused by using different clock settings from
Linux to Windows. Deselect UTC to make it use local time.
2) Use ntpdate to sync the time.

A few other points:

1) Linux maintains both a system and a hardware clock. On bootup, the
system copies the hardware clock to the system time.  There can be
drift between the two clocks (especially in virtual environments), so
on shutdown the system does a sync from the system to the hardware
clock.

2) The ntpd daemon will not adjust the system time beyond a few
minutes. If you want to hard set the time, you need to use ntpdate
first then turn on ntpd to keep it accurate. ntpdate does allow the
system to slowly adjust the clock and this is useful to keep logs
sane.

3) Be careful when forcing a time change on a running system. Time
shifting backwards can wreak havoc on certain applications such as
databases.



More information about the CentOS mailing list