Fix Error handling with ntp.settime()
This commit is contained in:
parent
7a1371fd18
commit
4b98e63c22
11
code/main.py
11
code/main.py
@ -91,12 +91,15 @@ def set_rtc():
|
|||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
return ntptime.settime()
|
return ntptime.settime()
|
||||||
except OSError as e:
|
except OSError as err:
|
||||||
if e.errno == 110:
|
print("OS error: {0}".format(err))
|
||||||
|
if err.args[0] == 110:
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
except OverflowError as e:
|
except OverflowError as err:
|
||||||
print(e)
|
print("OverflowError: {0}".format(err))
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
except Exception as err:
|
||||||
|
return print(err)
|
||||||
|
|
||||||
|
|
||||||
def now(clock):
|
def now(clock):
|
||||||
|
Loading…
Reference in New Issue
Block a user