Debian 8。主机系统,无虚拟化。时间同步系统已禁用。未安装 ntp、rdate、sdwdate。
# timedatectl
Local time: Thu 2019-08-22 14:02:05 +03
Universal time: Thu 2019-08-22 11:02:05 UTC
RTC time: Thu 2019-08-22 11:00:10
Time zone: Europe/Minsk (+03, +0300)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
设定时间一秒后,它会改变几分钟。
例子:
# ntpdate 0.ru.pool.ntp.org && date && sleep 1 && date
22 Aug 14:02:28 ntpdate[31388]: step time server 195.211.77.68 offset -115.009072 sec
Thu Aug 22 14:02:28 +03 2019
Thu Aug 22 14:04:24 +03 2019
# hwclock --hctosys && date && sleep 1 && date
Thu Aug 22 14:01:51 +03 2019
Thu Aug 22 14:03:46 +03 2019
# date -s "2019-08-22 14:04:53" && date && sleep 1 && date
Thu Aug 22 14:04:53 +03 2019
Thu Aug 22 14:04:53 +03 2019
Thu Aug 22 14:06:49 +03 2019
手动更改时,日志中会出现消息
Aug 22 16:30:50 wisi systemd[1200]: Time has been changed
Aug 22 16:30:50 wisi systemd[1]: Time has been changed
Aug 22 16:32:45 wisi systemd[1200]: Time has been changed
Aug 22 16:32:45 wisi systemd[1]: Time has been changed
这里前两行是关于手动更改时间,后两行是关于系统“调整”时间回来。
# ps afx | grep [1]200
1200 ? Ss 0:06 /lib/systemd/systemd --user
尝试禁用timers.target、time-sync.target、systemd-timesyncd没有效果。
在tcpdump日志中可以看到,在“调整”时,123端口没有任何请求。“调整”的时间并不是恒定的,会发生变化,观察结果显示从1分钟到5分钟不等。
是什么原因造成的以及如何消除它?
更新1: @Seth,
观察改变后的 timedatectl 将会很有趣。
# timedatectl && ntpdate 0.ru.pool.ntp.org && timedatectl && sleep 1 && timedatectl
Local time: Fri 2019-08-23 14:10:57 +03
Universal time: Fri 2019-08-23 11:10:57 UTC
RTC time: Fri 2019-08-23 11:09:19
Time zone: Europe/Minsk (+03, +0300)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
23 Aug 14:09:25 ntpdate[19282]: step time server 192.36.143.130 offset -98.695079 sec
Local time: Fri 2019-08-23 14:09:25 +03
Universal time: Fri 2019-08-23 11:09:25 UTC
RTC time: Fri 2019-08-23 11:09:26
Time zone: Europe/Minsk (+03, +0300)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
Local time: Fri 2019-08-23 14:11:05 +03
Universal time: Fri 2019-08-23 11:11:05 UTC
RTC time: Fri 2019-08-23 11:09:27
Time zone: Europe/Minsk (+03, +0300)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
什么意思,它们没有效果?你有没有验证过这是否是一个正确的调整?
是的,当然,问题始于启用默认服务时。为了测试,我尝试停止它们,但这不会影响结果。
UPD2
为了测试,我断开了所有网线。一切如旧。但现在可以排除任何“网络”假设。
答案1
Oskam 将时间恢复到之前设定的时间。
https://github.com/gfto/oscam/blob/2780c48789c8e1427df4078ea9b06e0b51594bbc/oscam-time.c
#if defined(CLOCKFIX)
if (tv.tv_sec > lasttime.tv_sec || (tv.tv_sec == lasttime.tv_sec && tv.tv_usec >= lasttime.tv_usec)){ // check for time issues!
lasttime = tv; // register this valid time
}
else
{
tv = lasttime;
settimeofday(&tv, NULL); // set time back to last known valid time
//fprintf(stderr, "*** WARNING: BAD TIME AFFECTING WHOLE OSCAM ECM HANDLING, SYSTEMTIME SET TO LAST KNOWN VALID TIME **** \n");
}