在我的服务器上的时间是大约19个小时,我不能为我的生活弄清楚如何同步它。 我按照这里的步骤,这是输出:
[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 199.4.29.166 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 64.90.182.55 offset -0.002749 sec [root@ip-72-167-39-231 ~]# clock Mon 24 Oct 2011 01:45:24 PM MST -0.593604 seconds
针对评论中的build议:
[root@ip-72-167-39-231 ~]# ntpdate -u tick.usno.navy.mil 25 Oct 09:00:40 ntpdate[22294]: adjust time server 192.5.41.40 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 ~]#
还有更多…
[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
我不在乎,但现在发送的电子邮件已经显示在客户身上,好像是昨天下午发送的一样。
尝试以下操作:
ntpdate -u pool.ntp.org hwclock --adjust hwclock --systohc
这将更新您的时间设置从pool.ntp.org,调整您的时钟系统漂移,然后同步您的硬件时钟到您的系统时钟。 手表页面为hwclock
如果在VM主机上运行这些命令,则可能会对所有VM guest虚拟机及其显示正确时间的能力产生负面影响。 计划相应。
虽然我不知道hwclock是否会在VM guest虚拟机上做任何事情,但是我不会猜测。
在任何正常的 * nix系统上, ntpdate -u tick.usno.navy.mil应正确设置时钟。
如果您的时区设置已closures,则date命令仍将返回错误的“本地时间”。