I think there's something missleading here: response.orig_time
is the time of the client that made the request, not that of the server. See IETF RFC5905, p.23: "Origin Timestamp (org): Time at the client when the request departed for the server [...]". An up-to-date version of the code should look something like
import ntplib
from datetime import datetime, timezone
NTP_SERVERS = ['0.pool.ntp.org', 'uk.pool.ntp.org']
for server in NTP_SERVERS:
client = ntplib.NTPClient()
response = client.request(server, version=3)
print(f"server: {server}")
print(f"client time of request: {datetime.fromtimestamp(response.orig_time, timezone.utc)}")
print(f"server responded with: {datetime.fromtimestamp(response.tx_time, timezone.utc)}")
...would give me e.g.
server: 0.pool.ntp.org
client time of request: 2019-12-18 13:58:52.224058+00:00
server responded with: 2019-12-18 13:58:51.289734+00:00
server: uk.pool.ntp.org
client time of request: 2019-12-18 13:58:52.314615+00:00
server responded with: 2019-12-18 13:58:51.377655+00:00
Note that depending on how far the signal has to travel, the round trip delay (response.delay
) might be significant if you look for the milliseconds.