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:
try:
return ntptime.settime()
except OSError as e:
if e.errno == 110:
except OSError as err:
print("OS error: {0}".format(err))
if err.args[0] == 110:
time.sleep(2)
except OverflowError as e:
print(e)
except OverflowError as err:
print("OverflowError: {0}".format(err))
time.sleep(2)
except Exception as err:
return print(err)
def now(clock):