timedatectl:NTP 返回本地时间而不是 UTC 时间的问题

timedatectl:NTP 返回本地时间而不是 UTC 时间的问题

在我的嵌入式 Linux 上,我遇到时区问题:

我试图将 UTC 时间保留在设备的 RTC 中。但不知何故,timedatectl 不断调整时间当地的时间而不是 UTC 时间,尽管配置文件告诉它使用 UTC 时间。

我目前在时区“UTC+1”工作,因此我希望“time*.google.com”给我一个 1 小时的时间我们当地时间。但它只给我当地时间。

timedatectl status 返回以下值:

            Local time: Mon 2022-03-07 16:00:27 UTC
        Universal time: Mon 2022-03-07 16:00:27 UTC
                RTC time: Mon 2022-03-07 16:00:27
                Time zone: UTC (UTC, +0000)
System clock synchronized: no
            NTP service: active
        RTC in local TZ: no

timedatectl timesync-status 返回以下值:

    Server: (null) (time4.google.com)
Poll interval: 0 (min: 32s; max 34min 8s)
Packet count: 0

timedatectl list-timezones 仅返回:

UTC

如果我尝试关闭 ntp(使用timedatectl 设置 ntp false)我可以在RCT中手动设置真实的UTC时间,它可以工作。但一旦我重新激活 NTP,它就会自动返回到当地时间(尽管它一直告诉我它是 UTC)。

预先感谢您的见解..

编辑附加信息:

没有 /etc/localtime 文件:

root@Tep2020-88:/etc/systemd# ls -l /etc/localtime
ls: /etc/localtime: No such file or directory

没有 ntpd 守护进程在运行:

Log file: Service could not be found.

systemctl 状态 systemd-timedated.service回到:

* systemd-timedated.service - Time & Date Service
    Loaded: loaded (/lib/systemd/system/systemd-timedated.service; static; vendor preset: disabled)
    Active: inactive (dead)
    Docs: man:systemd-timedated.service(8)
            man:localtime(5)
            https://www.freedesktop.org/wiki/Software/systemd/timedated

Mar 07 15:38:33 Tep2020-88 systemd[1]: systemd-timedated.service: Succeeded.
Mar 07 15:49:40 Tep2020-88 systemd[1]: Starting Time & Date Service...
Mar 07 15:49:40 Tep2020-88 systemd[1]: Started Time & Date Service.
Mar 07 15:50:10 Tep2020-88 systemd[1]: systemd-timedated.service: Succeeded.
Mar 07 16:00:27 Tep2020-88 systemd[1]: Starting Time & Date Service...
Mar 07 16:00:27 Tep2020-88 systemd[1]: Started Time & Date Service.
Mar 07 16:00:57 Tep2020-88 systemd[1]: systemd-timedated.service: Succeeded.
Mar 07 16:08:25 Tep2020-88 systemd[1]: Starting Time & Date Service...
Mar 07 16:08:25 Tep2020-88 systemd[1]: Started Time & Date Service.
Mar 07 16:08:55 Tep2020-88 systemd[1]: systemd-timedated.service: Succeeded.

systemctl 状态 systemd-timesyncd.service回到:

[[0;1;32m*[[0m systemd-timesyncd.service - Network Time Synchronization
    Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
    Active: [[0;1;32mactive (running)[[0m since Mon 2022-03-07 15:44:40 UTC; 1h 39min ago
    Docs: man:systemd-timesyncd.service(8)
Main PID: 591 (systemd-timesyn)
    Status: "Idle."
    Tasks: 2 (limit: 1021)
    Memory: 668.0K
    CGroup: /system.slice/systemd-timesyncd.service
            `-591 /lib/systemd/systemd-timesyncd

Mar 07 15:44:40 Tep2020-88 systemd[1]: Starting Network Time Synchronization...
Mar 07 15:44:40 Tep2020-88 systemd[1]: Started Network Time Synchronization.

相关内容