We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0c5880d commit be5c711Copy full SHA for be5c711
micropython/net/ntptime/ntptime.py
@@ -11,6 +11,8 @@
11
12
# The NTP host can be configured at runtime by doing: ntptime.host = 'myhost.org'
13
host = "pool.ntp.org"
14
+# The NTP socket timeout can be configured at runtime by doing: ntptime.timeout = 1.0
15
+timeout = 1.0
16
17
18
def time():
@@ -19,7 +21,7 @@ def time():
19
21
addr = socket.getaddrinfo(host, 123)[0][-1]
20
22
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
23
try:
- s.settimeout(1)
24
+ s.settimeout(timeout)
25
res = s.sendto(NTP_QUERY, addr)
26
msg = s.recv(48)
27
finally:
0 commit comments