Time on macbook (Mojave) is incorrect with auto-time on (Is apple time server wrong?)
I just realized that the time on my Macbook Pro running Mojave is incorrect. For example, current time shown is 22:47. But the correct time should be 22:39.
I tried all listed time servers (three servers) on time settings, but no luck. All my time settings are correct.
I tried many ways to fix it with no luck. For example, I tried to turn off auto-time option, set a wrong time and then turn auto-time option on etc.. The auto-time always gives me the same wrong time. (8m difference)
So what is the problem and how to fix it?
Btw, the reason why I know what the correct time is because all my mobiles, other Linux PCs, google can tell me the correct time.
More:
I ran the following commands suggested by one comment and it fixed the problem.
$ sntp -d $(< /etc/ntp.conf); echo; sudo sntp -S $(< /etc/ntp.conf)
sntp [email protected] Tue Mar 21 14:36:42 UTC 2017 (136.200.1~4588)
kod_init_kod_db(): Cannot open KoD db file /var/db/ntp-kod: No such file or directory
handle_lookup(server,0x2)
move_fd: estimated max descriptors: 65536, initial socket boundary: 20
handle_lookup(time.apple.com.,0x2)
server lookup error nodename nor servname provided, or not known
sntp sendpkt: Sending packet to 17.253.16.253:123 ...
Packet sent.
sntp sendpkt: Sending packet to 17.253.26.125:123 ...
Packet sent.
sock_cb: time.apple.com. 17.253.26.125:123
2020-04-09 23:22:05.625789 (-0800) -488.274511 +/- 325.516966 time.apple.com. 17.253.26.125 s1 no-leap
sntp [email protected] Tue Mar 21 14:36:42 UTC 2017 (136.200.1~4588)
kod_init_kod_db(): Cannot open KoD db file /var/db/ntp-kod: No such file or directory
server lookup error nodename nor servname provided, or not known
2020-04-09 23:22:10.854075 (-0800) -488.226441 +/- 325.484462 time.apple.com. 17.253.16.253 s1 no-leap
Solution 1:
You can trigger the sync manually by running
sudo sntp -S $(sed -n '/^server/s/.* //p' /etc/ntp.conf)
(just ignore the kod_init_kod_db
error or run sudo touch /var/db/ntp-kod
to create the missing file)