PDA

View Full Version : Is the time in the server wrong?


alsierra
2004-01-09, 22:25 PM
I have just reboted my server. It reports this time:

# date
Fri Jan 9 16:04:48 CST 2004
# hwclock
Fri Jan 9 16:04:54 2004 -0.305388 seconds

But my clock (central time, same as in TX) says: 21:11 local, .03:11 UTC

Some days ago I corrected the date with a simple ntpdate call to a ntp server. After rebooting it was reseted as it was at the beggining.

Why iis this? Any hint?

QT
2004-01-09, 22:31 PM
You need to sync the hardware clock to the system clock (as root):

# hwclock --systohw

alsierra
2004-01-09, 22:37 PM
Originally posted by QT
You need to sync the hardware clock to the system clock (as root)

# hwclock --systohw

QT, please read again my message. The sync between clocks are not the problem:

# date
Fri Jan 9 16:04:48 CST 2004
# hwclock
Fri Jan 9 16:04:54 2004 -0.305388 seconds

The problem is that they are not the same as the real time: 21:1 local (03:11 UTC) !! :confused:

knightfoo
2004-01-09, 22:51 PM
QT is correct. The problem is that you did not sync the system clock to the hardware clock after you set the time. When your server boots, Linux reads the hardware clock in order to set the system time. From this point on, Linux keeps track of time itself within the kernel. When you change the time with ntpdate, rdate, or date, you are changing the system clock, not the hardware clock. If you do not sync the hardware clock and the system clock then your time will be wrong when you reboot.

# ntpdate -u -b time.nist.gov
# hwclock --systohc

The system clock and the hardware clock will never stay synced up exactly, since Linux uses a timing loop in the kernel to keep track of the time which can be affected by system load and other processes. It is a good idea to run ntpdate and ntpd to keep your system time synced at all times.

-knightfoo

alsierra
2004-01-10, 11:05 AM
Originally posted by knightfoo
QT is correct. The problem is that you did not sync the system clock to the hardware clock after you set the time.

-knightfoo

OK. Then it was a really silly mistake from myself.

The time I suppose was not updated at installation time.

nepcw
2004-03-12, 15:52 PM
thanks a bunch~~ worked great