在新版的ubuntu中,使用timedatectl 替换了ntpdate来进行时间管理
一、查看当前时间,timedatectl status
root@yuxy:/home/test/2.0.1-a1# timedatectl status
Local time: Fri 2021-08-13 01:51:37 UTC
Universal time: Fri 2021-08-13 01:51:37 UTC
RTC time: Fri 2021-08-13 01:51:37
Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
二、修改当前时间,timedatectl set-timezone "Asia/Shanghai"
三、再次查看时间,时间被修改
root@yuxy:/home/test/2.0.1-a1# timedatectl status
Local time: Fri 2021-08-13 09:52:11 CST
Universal time: Fri 2021-08-13 01:52:11 UTC
RTC time: Fri 2021-08-13 01:52:10
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no