6

macOS ntp not working

 2 years ago
source link: https://sskaje.me/2021/09/30/macos-ntp-not-working/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Skip to content

macOS ntp not working


我的老macbook pro总是时不时跟ntp服务器对不上时间,少的时候差几秒,多的时候几分钟。之前root下 crontab 每小时跟aliyun ntp对时,结果这次怎么执行都会偏差两秒,连续sntp也还是两秒。

1 mac 同步时间使用 sntp,命令格式

sudo sntp -sS ntp.ntsc.ac.cn

2 sntp的输出可以使用 -d 来看到 debug log,基本格式是

+2.017470 +/- 0.000153 ntp.ntsc.ac.cn 114.118.7.161

上边是我的输出,我连续执行1 的命令,每次第一列都是2秒左右,开 -d 可以看到解释

ipaddr:         114.118.7.163
+2.020197 +/- 0.069878 ntp.ntsc.ac.cn 114.118.7.163
  gtod:  1633021695.100748
adjust:           2.020196
   set:  1633021697.120944

快速解决方案,把timed kill掉,再sntp同步,就好了。

稳定解决方案,暂无。

长期不稳定但有效的解决方案,写脚本,连续 n 次采样偏差,自动杀 timed,反正系统自己会起。

September 30, 2021

sskaje


Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Comment *

Name *

Email *

Website

Save my name, email, and website in this browser for the next time I comment.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK