Fix Error handling with ntp.settime()

This commit is contained in:
arofarn 2020-04-25 17:46:26 +02:00
parent 7a1371fd18
commit 4b98e63c22

View File

@ -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):