On Sun, Feb 6, 2011 at 7:56 PM, Kwan Lowe kwan.lowe@gmail.com wrote:
On Sun, Feb 6, 2011 at 4:35 PM, Buz Davis buzdavis@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:
- 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:
- 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.
- 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.
- Be careful when forcing a time change on a running system. Time
shifting backwards can wreak havoc on certain applications such as databases.
ntpdate is normally executed at boot tiime by the ntp init script. If you're on an unconnected wireless or modem at the time, this command will fall through to using the local hardware clock, which is listed as a "fudge" server in ntp.conf, just in case you can't reach the real NTP servers.