The time on my server is about 19 hours behind and I cannot for the life of me figure out how to synchronize it. I did follow the steps here, and this is the output:

[root@ip-72-167-39-231 ~]# /sbin/service ntpd stop
Shutting down ntpd:                                        [  OK  ]
[root@ip-72-167-39-231 ~]# /usr/sbin/ntpdate 0.pool.ntp.org
25 Oct 08:42:32 ntpdate[22173]: adjust time server offset 0.034126 sec
[root@ip-72-167-39-231 ~]# clock
Mon 24 Oct 2011 01:43:18 PM MST  -0.344112 seconds
[root@ip-72-167-39-231 ~]# /usr/sbin/ntpdate nist1-ny.ustiming.org
25 Oct 08:44:41 ntpdate[22180]: adjust time server offset -0.002749 sec
[root@ip-72-167-39-231 ~]# clock
Mon 24 Oct 2011 01:45:24 PM MST  -0.593604 seconds

In response to suggestions in the comments:

[root@ip-72-167-39-231 ~]# ntpdate -u tick.usno.navy.mil
25 Oct 09:00:40 ntpdate[22294]: adjust time server offset 0.111328 sec

[root@ip-72-167-39-231 ~]# clock
Mon 24 Oct 2011 02:00:46 PM MST  -0.140884 seconds
[root@ip-72-167-39-231 ~]# date
Tue Oct 25 09:01:10 MST 2011

[root@ip-72-167-39-231 ~]# TZ=Z date
Tue Oct 25 16:01:20  2011
[root@ip-72-167-39-231 ~]#

Yet more...

[root@ip-72-167-39-231 zoneinfo]# ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
[root@ip-72-167-39-231 zoneinfo]# clock
Mon 24 Oct 2011 05:17:24 PM EDT  -0.270220 seconds

[root@ip-72-167-39-231 zoneinfo]# export TZ=America/New_York
[root@ip-72-167-39-231 zoneinfo]# clock
Mon 24 Oct 2011 05:21:42 PM EDT  -0.656424 seconds

I wouldn't care, but email that is sent right now is showing up on clients as if it was sent yesterday afternoon...

  • Is timezone correct? – quanta Oct 25 '11 at 15:53
  • Quanta, the time zone on the server is MST, but it's not correct even for that. It is 9.55am MST currently, but it's showing as 1:55pm yesterday. – Thomas Thorogood Oct 25 '11 at 15:55
  • 1
    Is this a VM? Also, that looks like you're 19 hours behind (8AM to 1PM the previous day) not 28. Does date return the same thing as [hw]clock? (as an aside, you don't need to shut down ntpd if you use -u with ntpdate) – DerfK Oct 25 '11 at 15:58
  • What happens if you run TZ=Z date? – wfaulk Oct 25 '11 at 15:58
  • Responses to these suggestions have been updated and edited above. I am not sure what "VM" stands for. It is a dedicated server, not virtual. – Thomas Thorogood Oct 25 '11 at 16:03

Try the following:

ntpdate -u pool.ntp.org
hwclock --adjust
hwclock --systohc

This will update your time settings from pool.ntp.org, adjust your hwclock for systematic drift, and then sync your hardware clock to your system clock. man page for hwclock

If you run these commands on a VM host this may adversely affect all of the VM guests and their ability to display the correct time. Plan accordingly.

Although I don't know if the hwclock -s will do anything on the VM guest ... I am going to guess no.

  • That did it! I am the only user on this server; this won't affect anyone else. – Thomas Thorogood Oct 25 '11 at 16:36
  • Great! Glad to help. :) – Joseph Kern Oct 25 '11 at 16:40
  • Is hwclock a 'fire and forget' command, or does it need to be invoked every time ntpdate is run? – user70463 Sep 20 '13 at 18:56
  • Ah, I see that ntpd can be configured to sync the hwclock. – user70463 Sep 20 '13 at 19:04

On any normal *nix system, ntpdate -u tick.usno.navy.mil should set the clock correctly.

If your timezone settings are off, the date command will still return the wrong "local time".

  • 25 Oct 09:00:40 ntpdate[22294]: adjust time server offset 0.111328 sec [root@ip-72-167-39-231 ~]# clock Mon 24 Oct 2011 02:00:46 PM MST -0.140884 seconds – Thomas Thorogood Oct 25 '11 at 16:00
  • Your timezone settings are off, but the server has the correct UTC time. Running date -u should confirm this. It should return "Tue Oct 25 16:03:14 UTC 2011" as of a few seconds ago. – Chris S Oct 25 '11 at 16:02
  • Okay. But I still do not know how to update it. – Thomas Thorogood Oct 25 '11 at 16:08
  • 1
    cyberciti.biz/faq/… basically ln /usr/share/zoneinfo/[TZ_Code] /etc/localtime (Note: /etc/localtime probably already exists and is linked to something wrong). – Chris S Oct 25 '11 at 16:08
  • 1
    @JosephKern They're quite reliable, but the Navy is more; for one off syncs I commonly use tick. For any recurring polling I would always recommend using several of the pool servers. – Chris S Oct 25 '11 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.