我的正确时间是 UTC -5。
我可以修改sudo ntpdate ntp.uiuc.edu
它并修复时间,但在下次启动时又会恢复为错误的时间。无论我将时区设置为多少,它都不会在当前会话之后持续存在。我迷路了,我试过了我知道的所有日期/时间修改器。谢谢。
┌──(charles㉿LA)-[~]
└─$ date
Thu Sep 15 12:39:09 PM CDT 2022 ***(THIS IS 5 HOURS EARLIER THAN THE CORRECT LOCAL TIME)***
┌──(charles㉿LA)-[~]
└─$ timedatectl
Local time: Thu 2022-09-15 12:39:15 CDT ***(5 HOURS EARLIER THAN CORRECT LOCAL TIME)***
Universal time: Thu 2022-09-15 17:39:15 UTC ***(THIS SHOULD BE +5 TO BE CORRECT UTC, WHAT IS SHOWN HERE NOW AS UTC IS ACTUALLY THE CORRECT LOCAL TIME)***
RTC time: Thu 2022-09-15 17:39:15
Time zone: US/Central (CDT, -0500) ***(CORRECT TIME ZONE)***
System clock synchronized: no
NTP service: inactive
RTC in local TZ: no
┌──(charles㉿LA)-[~]
└─$ sudo ntpdate ntp.uiuc.edu
[sudo] password for charles:
ntpdig: socket error on transmission: [Errno 99] Cannot assign requested address
ntpdig: socket error on transmission: [Errno 99] Cannot assign requested address
ntpdig: socket error on transmission: [Errno 99] Cannot assign requested address
{"time":"2022-09-15T17:41:24.7665-0500","offset":17990.543553,"precision":0.039600,"host":"ntp.uiuc.edu","ip":"130.126.24.44","stratum":2,"leap":"no-leap","adjusted":true}
CLOCK: time stepped by 17990.543553
┌──(charles㉿LA)-[~]
└─$ date
Thu Sep 15 05:41:31 PM CDT 2022 ***(NOW IT IS CORRECT)***
答案1
启动后,系统日期根据硬件时钟设置。因此,在使用 ntpdate 设置软件时钟后,您需要使用以下命令将其与硬件时钟同步
sudo hwclock——systohc