Open peter-mount opened 2 years ago
I changed the definition line in npt.py to:
def fetch(synch_with_rtc=True, timeout=10, ntp_host="pool.ntp.org"):
# ntp_host = "pool.ntp.org"
And then called it like this:
timestamp = ntp.fetch(True, 10, "ntp-b.nist.gov")
Seems to work.
DEFAULT_NTP_HOST = "pool.ntp.org"
def fetchFromPool(synch_with_rtc=True, timeout=10, tzinfo=0,
pool = (DEFAULT_NTP_HOST,)):
for ntp_host in pool:
ts = fetch(synch_with_rtc=synch_with_rtc, timeout=timeout,
tzinfo=tzinfo, ntp_host=ntp_host)
if ts is not None:
return ts
return None
...
ts = fetchFromPool(True, 10, ( "ntp-b.hist.gov", DEFAULT_NTP_HOST ) )
Currently NTP is hardcoded to
pool.ntp.org
which means that whenever the clock needs to be resynced it involves accessing a service outside of the local network.For instances where either the internet is not always accessible, or firewalled, some environments have their own ntp servers. Others might use a different ntp pool.
So a means of enabling an alternate ntp server other than the hardcoded one would be useful.