英文:
htpdate does not update time
问题
我有两台机器,一台是Rpi4,另一台是Ubuntu PC。这两台机器都是离网的,并连接到它们各自的网络。我的想法是将RPi4的时间与Ubuntu机器同步。由于端口和防火墙问题,NTP方法失败了,所以我改用htpdate
。然而,我注意到无论使用什么命令,都无法消除时间偏移。
我在其他地方寻找了如何同步的方法,但没有成功:
问题是我无法消除时间偏移。我的会话输出如下:
pi@CMPL01-003-21:~ $ sudo htpdate -qd 10.42.0.1
burst: 1 try: 1 when: 500000
10.42.0.1 80 14 Feb 2023 13:37:24 GMT (0.003) => 38
burst: 1 try: 2 when: 500000
10.42.0.1 80 14 Feb 2023 13:37:25 GMT (0.006) => 38
#: 1 mean: 38 average: 38.000
Offset 38.000 seconds
poll 1800 s
pi@CMPL01-003-21:~ $ sudo htpdate -xqd 10.42.0.1
burst: 1 try: 1 when: 500000
10.42.0.1 80 14 Feb 2023 13:39:25 GMT (0.003) => 38
burst: 1 try: 2 when: 500000
10.42.0.1 80 14 Feb 2023 13:39:26 GMT (0.003) => 38
#: 1 mean: 38 average: 38.000
Adjusting 38.000 seconds
poll 1800 s
pi@CMPL01-003-21:~ $ sudo htpdate -sd 10.42.0.1
burst: 1 try: 1 when: 500000
10.42.0.1 80 14 Feb 2023 13:40:26 GMT (0.003) => 38
burst: 1 try: 2 when: 500000
10.42.0.1 80 14 Feb 2023 13:40:27 GMT (0.005) => 38
#: 1 mean: 38 average: 38.000
Setting 38.000 seconds
Set: Tue Feb 14 14:40:27 2023
poll 1800 s
是否有遗漏的隐藏的htpdate
参数或者一些要应用于文件夹的规则以清除偏移?
英文:
I have two machines, a Rpi4 and Ubuntu PC. The two machines are offgrid and connected to their network. The idea is to sync the RPi4 time with the Ubuntu machine. The NTP aproach failed because port and firewall issues. So I used htpdate
instead. I've noticed however that I can not set the correct system time of the Rpi4. Regardless of the command I can not get rid of the offset.
I looked elsewhere on how to sync without success:
- synchronising-time-between-two-linux-machines
- how-to-sync-raspberry-pi-system-clock
- how-to-know-if-htpdate-has-synchronized-system-clock
- htpdate.8.en.html
- htpdate.php
The problem is I can not get rid of the offset. The output of my sessions are:
pi@CMPL01-003-21:~ $ sudo htpdate -qd 10.42.0.1
burst: 1 try: 1 when: 500000
10.42.0.1 80 14 Feb 2023 13:37:24 GMT (0.003) => 38
burst: 1 try: 2 when: 500000
10.42.0.1 80 14 Feb 2023 13:37:25 GMT (0.006) => 38
#: 1 mean: 38 average: 38.000
Offset 38.000 seconds
poll 1800 s
pi@CMPL01-003-21:~ $ sudo htpdate -xqd 10.42.0.1
burst: 1 try: 1 when: 500000
10.42.0.1 80 14 Feb 2023 13:39:25 GMT (0.003) => 38
burst: 1 try: 2 when: 500000
10.42.0.1 80 14 Feb 2023 13:39:26 GMT (0.003) => 38
#: 1 mean: 38 average: 38.000
Adjusting 38.000 seconds
poll 1800 s
pi@CMPL01-003-21:~ $ sudo htpdate -sd 10.42.0.1
burst: 1 try: 1 when: 500000
10.42.0.1 80 14 Feb 2023 13:40:26 GMT (0.003) => 38
burst: 1 try: 2 when: 500000
10.42.0.1 80 14 Feb 2023 13:40:27 GMT (0.005) => 38
#: 1 mean: 38 average: 38.000
Setting 38.000 seconds
Set: Tue Feb 14 14:40:27 2023
poll 1800 s
Is there a missing hidden htpdate parameter or some rules to apply to a folder maybe to clear the offset?
答案1
得分: 1
我升级了htpdate的版本,从1.2.0升级到1.3.7,然后再次尝试。结果是一样的,偏移仍然存在,不同之处在于命令输出指出客户机正在运行自动的NTP同步服务。之后,我成功地使用htpdate进行同步,通过使用sudo timedatectl set-ntp false
禁用了该服务。案件已结。
英文:
I upgraded the version of htpdate from 1.2.0 to 1.3.7 and tried again. The result was the same and the offset was still there with the difference that the command output noted the client machine was running the automatic ntp sync service. Afterward I was able to sync correctly with htpdate after disabling the service with sudo timedatectl set-ntp false
. Case closed.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论