rtc测试

同步时间到RTC测试

最开始时间

[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:02:12 CST
  Universal time: Thu 2023-06-29 04:02:12 UTC
        RTC time: Thu 2023-06-29 12:02:12
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.

[root@localhost ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*203.107.6.88    100.107.25.114   2 u   50   64    3   45.393   40.465   2.529
 120.25.115.20   .INIT.          16 u    -   64    0    0.000    0.000   0.000
[root@localhost ~]#

手动修改系统时间,再同步到硬件时间

[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:02:12 CST
  Universal time: Thu 2023-06-29 04:02:12 UTC
        RTC time: Thu 2023-06-29 12:02:12
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*203.107.6.88    100.107.25.114   2 u   50   64    3   45.393   40.465   2.529
 120.25.115.20   .INIT.          16 u    -   64    0    0.000    0.000   0.000
[root@localhost ~]# date -s "12:00"
Thu Jun 29 12:00:00 CST 2023
[root@localhost ~]# date
Thu Jun 29 12:00:02 CST 2023
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:00:10 CST
  Universal time: Thu 2023-06-29 04:00:10 UTC
        RTC time: Thu 2023-06-29 12:03:57
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*203.107.6.88    100.107.25.114   2 u   19   64    7   45.393   40.465   2.529
 120.25.115.20   10.137.53.7      2 u 4971   64    1   44.223   22.577   0.000
[root@localhost ~]# ntpdate -d -u 203.107.6.88
29 Jun 12:00:34 ntpdate[1805]: ntpdate 4.2.6p5@1.2349-o Tue Jun 23 15:38:19 UTC 2020 (1)
Looking for host 203.107.6.88 and service ntp
host found : 203.107.6.88
transmit(203.107.6.88)
receive(203.107.6.88)
transmit(203.107.6.88)
receive(203.107.6.88)
transmit(203.107.6.88)
receive(203.107.6.88)
transmit(203.107.6.88)
receive(203.107.6.88)
server 203.107.6.88, port 123
stratum 2, precision -25, leap 00, trust 000
refid [203.107.6.88], delay 0.06520, dispersion 0.00017
transmitted 4, in filter 4
reference time:    e8478145.2561b834  Thu, Jun 29 2023 12:04:21.146
originate timestamp: e847814b.f1c22734  Thu, Jun 29 2023 12:04:27.944
transmit timestamp:  e8478068.d026870a  Thu, Jun 29 2023 12:00:40.813
filter delay:  0.06610  0.06572  0.06520  0.06525 
         0.00000  0.00000  0.00000  0.00000 
filter offset: 227.1122 227.1116 227.1115 227.1113
         0.000000 0.000000 0.000000 0.000000
delay 0.06520, dispersion 0.00017
offset 227.111539

29 Jun 12:00:40 ntpdate[1805]: step time server 203.107.6.88 offset 227.111539 sec
[root@localhost ~]# hwclock -w
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:01:10 CST
  Universal time: Thu 2023-06-29 04:01:10 UTC
        RTC time: Thu 2023-06-29 12:01:10
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.

修正系统时间

29 Jun 12:01:41 ntpdate[1828]: step time server 203.107.6.88 offset 227.108131 sec
[root@localhost ~]# ntpdate   203.107.6.88
29 Jun 12:01:54 ntpdate[1832]: the NTP socket is in use, exiting
[root@localhost ~]# ntpdate  -u  203.107.6.88
29 Jun 12:06:00 ntpdate[1833]: step time server 203.107.6.88 offset 227.102268 sec
[root@localhost ~]# ntpdate -d -u 203.107.6.88
29 Jun 12:06:09 ntpdate[1834]: ntpdate 4.2.6p5@1.2349-o Tue Jun 23 15:38:19 UTC 2020 (1)
Looking for host 203.107.6.88 and service ntp
host found : 203.107.6.88
transmit(203.107.6.88)
receive(203.107.6.88)
transmit(203.107.6.88)
receive(203.107.6.88)
transmit(203.107.6.88)
receive(203.107.6.88)
transmit(203.107.6.88)
receive(203.107.6.88)
server 203.107.6.88, port 123
stratum 2, precision -25, leap 00, trust 000
refid [203.107.6.88], delay 0.07175, dispersion 0.00041
transmitted 4, in filter 4
reference time:    e8478184.a94692b2  Thu, Jun 29 2023 12:05:24.661
originate timestamp: e84781b7.6bfa52ff  Thu, Jun 29 2023 12:06:15.421
transmit timestamp:  e84781b7.65b914f8  Thu, Jun 29 2023 12:06:15.397
filter delay:  0.11670  0.07175  0.07175  0.07193 
         0.00000  0.00000  0.00000  0.00000 
filter offset: 0.000994 0.001967 0.001668 0.001262
         0.000000 0.000000 0.000000 0.000000
delay 0.07175, dispersion 0.00041
offset 0.001967

29 Jun 12:06:15 ntpdate[1834]: adjust time server 203.107.6.88 offset 0.001967 sec

rtc时间不一致环境已经构建好

[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:06:51 CST
  Universal time: Thu 2023-06-29 04:06:51 UTC
        RTC time: Thu 2023-06-29 12:03:04
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.

方法1:/etc/sysconfig/ntpd

修改

[root@localhost ~]# vim /etc/sysconfig/ntpd
[root@localhost ~]# systemctl restart ntpd  ^C
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:09:13 CST
  Universal time: Thu 2023-06-29 04:09:13 UTC
        RTC time: Thu 2023-06-29 12:05:26
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# systemctl restart ntpd
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:09:27 CST
  Universal time: Thu 2023-06-29 04:09:27 UTC
        RTC time: Thu 2023-06-29 12:05:40
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:09:29 CST
  Universal time: Thu 2023-06-29 04:09:29 UTC
        RTC time: Thu 2023-06-29 12:05:42
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:09:30 CST
  Universal time: Thu 2023-06-29 04:09:30 UTC
        RTC time: Thu 2023-06-29 12:05:43
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:09:32 CST
  Universal time: Thu 2023-06-29 04:09:32 UTC
        RTC time: Thu 2023-06-29 12:05:45
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:09:33 CST
  Universal time: Thu 2023-06-29 04:09:33 UTC
        RTC time: Thu 2023-06-29 12:05:45
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:09:33 CST
  Universal time: Thu 2023-06-29 04:09:33 UTC
        RTC time: Thu 2023-06-29 12:05:45
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:13:20 CST
  Universal time: Thu 2023-06-29 04:13:20 UTC
        RTC time: Thu 2023-06-29 12:13:20
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# 

有效果

重新测试

[root@localhost ~]# date -s "12:00"
Thu Jun 29 12:00:00 CST 2023
[root@localhost ~]# hwclock -w
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:00:12 CST
  Universal time: Thu 2023-06-29 04:00:12 UTC
        RTC time: Thu 2023-06-29 12:00:12
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.

同步系统时间

[root@localhost ~]# ntpdate  -u  203.107.6.88
29 Jun 12:19:21 ntpdate[1900]: step time server 203.107.6.88 offset 1098.176945 sec
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:19:23 CST
  Universal time: Thu 2023-06-29 04:19:23 UTC
        RTC time: Thu 2023-06-29 12:01:05
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# 

观察一段时间后

[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:28:58 CST
  Universal time: Thu 2023-06-29 04:28:58 UTC
        RTC time: Thu 2023-06-29 12:10:40
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.

重启ntpd服务之后在观察

[root@localhost ~]# systemctl restart ntpd
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:29:33 CST
  Universal time: Thu 2023-06-29 04:29:33 UTC
        RTC time: Thu 2023-06-29 12:11:15
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:29:34 CST
  Universal time: Thu 2023-06-29 04:29:34 UTC
        RTC time: Thu 2023-06-29 12:11:16
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:29:35 CST
  Universal time: Thu 2023-06-29 04:29:35 UTC
        RTC time: Thu 2023-06-29 12:11:17
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:32:14 CST
  Universal time: Thu 2023-06-29 04:32:14 UTC
        RTC time: Thu 2023-06-29 12:32:14
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:32:16 CST
  Universal time: Thu 2023-06-29 04:32:16 UTC
        RTC time: Thu 2023-06-29 12:32:16
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:32:17 CST
  Universal time: Thu 2023-06-29 04:32:17 UTC
        RTC time: Thu 2023-06-29 12:32:17
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:32:18 CST
  Universal time: Thu 2023-06-29 04:32:18 UTC
        RTC time: Thu 2023-06-29 12:32:18
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# 

重启之后有效

测试去掉参数

[root@localhost ~]# cat /etc/sysconfig/ntpd
# Command line options for ntpd
OPTIONS="-g"
#SYNC_HWCLOCK=yes

[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:33:35 CST
  Universal time: Thu 2023-06-29 04:33:35 UTC
        RTC time: Thu 2023-06-29 12:33:35
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# date -s "12:20"
Thu Jun 29 12:20:00 CST 2023
[root@localhost ~]# hwclock -w
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:20:14 CST
  Universal time: Thu 2023-06-29 04:20:14 UTC
        RTC time: Thu 2023-06-29 12:20:15
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# ntpdate  -u  203.107.6.88
29 Jun 12:34:23 ntpdate[1990]: step time server 203.107.6.88 offset 831.497776 sec
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:34:32 CST
  Universal time: Thu 2023-06-29 04:34:32 UTC
        RTC time: Thu 2023-06-29 12:20:41
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# 

观察一段时间

[root@localhost ~]# date -s "12:20"
Thu Jun 29 12:20:00 CST 2023
[root@localhost ~]# hwclock -w
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:20:14 CST
  Universal time: Thu 2023-06-29 04:20:14 UTC
        RTC time: Thu 2023-06-29 12:20:15
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# ntpdate  -u  203.107.6.88
29 Jun 12:34:23 ntpdate[1990]: step time server 203.107.6.88 offset 831.497776 sec
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:34:32 CST
  Universal time: Thu 2023-06-29 04:34:32 UTC
        RTC time: Thu 2023-06-29 12:20:41
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# systemctl restart ntpd
[root@localhost ~]# systemctl status ntpd
● ntpd.service - Network Time Service
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2023-06-29 12:35:06 CST; 6s ago
  Process: 2004 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 2005 (ntpd)
   CGroup: /system.slice/ntpd.service
           └─2005 /usr/sbin/ntpd -u ntp:ntp -g

Jun 29 12:35:06 localhost.localdomain ntpd[2005]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Jun 29 12:35:06 localhost.localdomain ntpd[2005]: Listen and drop on 1 v6wildcard :: UDP 123
Jun 29 12:35:06 localhost.localdomain ntpd[2005]: Listen normally on 2 lo 127.0.0.1 UDP 123
Jun 29 12:35:06 localhost.localdomain ntpd[2005]: Listen normally on 3 ens33 192.168.12.29 UDP 123
Jun 29 12:35:06 localhost.localdomain ntpd[2005]: Listen normally on 4 lo ::1 UDP 123
Jun 29 12:35:06 localhost.localdomain ntpd[2005]: Listen normally on 5 ens33 fe80::3078:750b:dcf7:d446 UDP 123
Jun 29 12:35:06 localhost.localdomain ntpd[2005]: Listening on routing socket on fd #22 for interface updates
Jun 29 12:35:06 localhost.localdomain ntpd[2005]: 0.0.0.0 c016 06 restart
Jun 29 12:35:06 localhost.localdomain ntpd[2005]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPM
Jun 29 12:35:06 localhost.localdomain ntpd[2005]: 0.0.0.0 c011 01 freq_not_set
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:35:14 CST
  Universal time: Thu 2023-06-29 04:35:14 UTC
        RTC time: Thu 2023-06-29 12:21:23
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:35:15 CST
  Universal time: Thu 2023-06-29 04:35:15 UTC
        RTC time: Thu 2023-06-29 12:21:24
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:35:16 CST
  Universal time: Thu 2023-06-29 04:35:16 UTC
        RTC time: Thu 2023-06-29 12:21:25
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:35:17 CST
  Universal time: Thu 2023-06-29 04:35:17 UTC
        RTC time: Thu 2023-06-29 12:21:26
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:35:18 CST
  Universal time: Thu 2023-06-29 04:35:18 UTC
        RTC time: Thu 2023-06-29 12:21:27
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 12:35:19 CST
  Universal time: Thu 2023-06-29 04:35:19 UTC
        RTC time: Thu 2023-06-29 12:21:27
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 13:17:08 CST
  Universal time: Thu 2023-06-29 05:17:08 UTC
        RTC time: Thu 2023-06-29 13:17:07
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
[root@localhost ~]# timedatectl 
      Local time: Thu 2023-06-29 13:17:10 CST
  Universal time: Thu 2023-06-29 05:17:10 UTC
        RTC time: Thu 2023-06-29 13:17:10
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: yes
      DST active: n/a

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.

posted @ 2023-06-29 13:18  罗论明  阅读(12)  评论(0编辑  收藏  举报