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. Thanks Buz Davis
On Sun, 6 Feb 2011, Buz Davis wrote:> To: centos at centos.org > From: Buz Davis <buzdavis at earthlink.net> > Subject: [CentOS] system clock > > 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.If you are connecting to the internet, you can use a program called ntpd: Name : ntp Arch : i386 Version : 4.2.2p1 Release : 9.el5.centos.2.1 Size : 2.4 M Repo : installed Summary : Synchronizes system time using the Network Time Protocol (NTP). URL : http://www.ntp.org License : distributable Description: The Network Time Protocol (NTP) is used to synchronize a : computer's time with another reference time source. The ntp : package contains utilities and daemons that will synchronize : your computer's time to Coordinated Universal Time (UTC) via : the NTP protocol and NTP servers. The ntp package includes : ntpdate (a program for retrieving the date and time from remote : machines via a network) and ntpd (a daemon which continuously : adjusts system time). : : Install the ntp package if you need tools for keeping your : system's time synchronized via the NTP protocol. HTH Keith Roberts ----------------------------------------------------------------- Websites: http://www.karsites.net http://www.php-debuggers.net http://www.raised-from-the-dead.org.uk All email addresses are challenge-response protected with TMDA [http://tmda.net] -----------------------------------------------------------------
On 02/06/2011 01:35 PM, Buz Davis 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.[...] CentOS likes to store the hardware system clock in GMT time. Windows likes to store it in the local time zone. The multi-hour switch is an artifact of dual booting with this disparity in play. If either system updates the hardware clock while running, the other OS will get thrown off by several hours. The fastest way to 'resync' the clock is using the ntpdate utiltity. It is part of the 'ntp' package. As root run: 'yum install ntp'. You can then reset the clock in CentOS by running 'ntpdate' as root. -- Benjamin Franz
On 6 Feb 2011, at 21:40, Buz Davis <buzdavis at earthlink.net> wrote:> Is there a simple way to adjust the time?Easy way - use the 'date' command, see http://linux.die.net/man/1/date Ben
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.
On Sunday, February 06, 2011 04:35:48 pm Buz Davis wrote:> I am running CntOS 5 with Gnome. Is > there a simple way to adjust the time?Use system-config-date (in the GNOME menu: System/Administration/Date&Time) Make sure 'System clock uses UTC' is unchecked in the timezone tab if you dual-boot with windows and don't have windows set to that setting. You can set up network stime servers in the 'Network Time Protocol' tab, and you can adjust the date and time easily in the 'Date & Time' tab.