在linux上错误的硬件时间

我在我的debian服务器上没有正确的硬件时间:

root@server[09:48]:date Tue Dec 22 09:48:52 EST 2015 root@server[09:48]:date -u Tue Dec 22 14:48:54 UTC 2015 root@server[09:48]:cat /etc/timezone Europe/Paris root@server[09:48]:hwclock -w --utc --debug hwclock from util-linux 2.25.2 Using the /dev interface to the clock. Last drift adjustment done at 1450795502 seconds after 1969 Last calibration done at 1450795502 seconds after 1969 Hardware clock is on UTC time Assuming hardware clock is kept in UTC time. Waiting for clock tick... ...got clock tick Time read from Hardware Clock: 2015/12/22 14:46:18 Hw clock time : 2015/12/22 14:46:18 = 1450795578 seconds since 1969 1450795578.500007 is close enough to 1450795578.500000 (0.000007 < 0.001000) Set RTC to 1450795578 (1450795578 + 0; refsystime = 1450795578.000000) Setting Hardware Clock to 14:46:18 = 1450795578 seconds since 1969 ioctl(RTC_SET_TIME) was successful. Not adjusting drift factor because it has been less than a day since the last calibration. root@server[09:48]:cat /etc/adjtime 0.000000 1450795578 0.000000 1450795578 UTC 

我该怎么办?

 root@server[10:04]:vi /etc/ntp.conf 18 # pool.ntp.org maps to about 1000 low-stratum NTP servers. Your server will 19 # pick a different set every time it starts up. Please consider joining the 20 # pool: <http://www.pool.ntp.org/join.html> 21 server ntp.ubuntu.com prefer 22 server ntp2.jussieu.fr 23 server 0.fr.pool.ntp.org 24 server 0.europe.pool.ntp.org root@server[10:04]:ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== golem.canonical 170.224.124.217 2 u 5 64 1 2.045 -0.616 0.000 horlogegps.rese 10.3.128.189 2 u 4 64 1 9.276 -0.195 0.000 62-210-204-185. 193.190.230.65 2 u 3 64 1 9.696 2.003 0.000 static.140.107. 192.53.103.108 2 u 2 64 1 16.062 1.159 0.000 

您的时区设置为EST(东部标准时间),这是纽约的时区,而不是巴黎。 巴黎的时间是CET(中欧时间)。

您必须首先正确设置时区,这可以通过几种方式完成:

  • 使用命令tzselect
  • 使用命令dpkg-reconfigure tzdata
  • TZ='Europe/Paris'; export TZ TZ='Europe/Paris'; export TZ~/.bash_profile~/.bash_login~/.profile

一旦时区正确,您可以设置正确的时间(如有必要)。