Is this just me? I was doing some late night hacking on a System 6 NTP client I'm working on, and I couldn't figure this out, until I looked at the tcpdump log and observed the date coming in wrong from Apple's timeserver. I can reproduce this with `ntpdate` and the SerenityOS `ntpquery` as well, so it can't be my code.
I always get this same reference timestamp back: 3889764561.575988850 (2023-04-06T10:09:21Z)
# ntpdate -q time.apple.com
server 17.253.82.253, stratum 1, offset +0.044020, delay 0.06635
server 17.253.82.125, stratum 1, offset +0.045065, delay 0.06586
server 17.253.16.125, stratum 1, offset +0.044869, delay 0.05829
6 Sep 15:25:18 ntpdate[65639]: adjust time server 17.253.16.125 offset +0.044869 sec $ sntp -n 1 time.apple.com | grep t1
t1: E8A36E57.9BB5D031 (3903024727.608242999)
# Subtract delta from unix time epoch to NTP epoch
# NTP epoch is January 1, 1900, Unix epoch is January 1, 1970
$ date -r $(expr 3903024727 - 2208988800)
Wed Sep 6 14:32:07 PDT 2023
Works for me. MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^- time.cloudflare.com 3 6 37 5 -2135us[-2132us] +/- 18ms
^- time.cloudflare.com 3 6 37 3 -1514us[-1511us] +/- 18ms
^- virginia.time.system76.c> 2 6 37 4 -2250us[-2247us] +/- 54ms
^- ohio.time.system76.com 2 6 37 2 -4525us[-4522us] +/- 42ms
^- oregon.time.system76.com 2 6 37 3 +742us[ +745us] +/- 30ms
^? 52.148.114.188 3 6 37 3 -544us[ -541us] +/- 124ms
^? defra1-ntp-004.aaplimg.c> 1 6 37 3 -1297us[-1294us] +/- 79ms
^? time4.facebook.com 1 6 37 4 -73us[ -71us] +/- 36ms
^? ec2-54-81-127-33.compute> 4 6 37 2 -369us[ -366us] +/- 35ms
^? time-a-wwv.nist.gov 1 6 17 42 +5816us[+5858us] +/- 24msAll your output here shows is that all the servers are equally reachable since you started chronyd (very recently, except the NIST server) and the Facebook server had the most similar time to what is on your system.
For the aaplimg service, you'd be better off using the general hostname than a specific server that appears to be on a different continent than you.
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 0000000000000000 1 6 377 72 -1724ns[-3212ns] +/- 134us
^+ 111111111111111111 2 6 377 70 +13us[ +13us] +/- 215us
^+ 222222222222222 1 6 377 68 -1064ns[-1064ns] +/- 135us
^- time.cloudflare.com 3 10 377 513 -1511us[-1525us] +/- 18ms
^- time.cloudflare.com 3 10 377 914 -2347us[-2375us] +/- 18ms
^- virginia.time.system76.c> 2 10 377 620 -987us[-1012us] +/- 54ms
^- ohio.time.system76.com 2 10 377 464 -2672us[-2685us] +/- 43ms
^- oregon.time.system76.com 2 10 377 511 +1921us[+1906us] +/- 30ms
^? 52.148.114.188 3 10 377 67m +7902us[+7908us] +/- 141ms
^? defra1-ntp-004.aaplimg.c> 1 10 377 563 +292us[ +275us] +/- 83ms
^? time4.facebook.com 1 10 377 468 -203us[ -216us] +/- 36ms
^? ec2-54-81-127-33.compute> 4 10 377 424 -887us[ -900us] +/- 35ms
^? time-a-wwv.nist.gov 1 10 377 492 +6515us[+6500us] +/- 25ms
I do use the generic time.apple.com entry along with other "official" names in my chrony.conf. I think my use of ODoH may be the reason why I'm getting systems further than expected. Will have to dig into it a little further. pool time.cloudflare.com iburst nts maxsources 2
server virginia.time.system76.com iburst nts
server ohio.time.system76.com iburst nts
server oregon.time.system76.com iburst nts
server time.windows.com iburst
server time.apple.com iburst
server time.facebook.com iburst
server time.aws.com iburst
server time.nist.gov iburst import socket
import struct
import time
NTP_SERVER = "time.apple.com"
NTP_PORT = 123
TIME1970 = 2208988800
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
data = b'\x1b' + 47 \* b'\0'
client.sendto(data, (NTP_SERVER, NTP_PORT))
data, addr = client.recvfrom(1024)
if data:
t = struct.unpack('!12I', data)[10]
t -= TIME1970
print("Current time:", time.ctime(t))