Skip to content

Commit 225562d

Browse files
committed
esp8266/scripts/ntptime: Allow to override NTP server.
This is not part of public API, variable name may change, or it can be replaced with a function.
1 parent 480159c commit 225562d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

esp8266/scripts/ntptime.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
# (date(2000, 1, 1) - date(1900, 1, 1)).days * 24*60*60
1111
NTP_DELTA = 3155673600
1212

13+
host = "pool.ntp.org"
14+
1315
def time():
1416
NTP_QUERY = bytearray(48)
1517
NTP_QUERY[0] = 0x1b
16-
addr = socket.getaddrinfo('pool.ntp.org', 123)[0][-1]
18+
addr = socket.getaddrinfo(host, 123)[0][-1]
1719
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
1820
s.settimeout(1)
1921
res = s.sendto(NTP_QUERY, addr)

0 commit comments

Comments
 (0)