Skip to content

Commit 560fcaf

Browse files
committed
fix ntp nina demo
1 parent b615e9b commit 560fcaf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ntp_simple_demo/ntp_demo_nina.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,16 @@
4040

4141
def try_set_time(esp, tz_offset=0):
4242
# get_time will raise ValueError if the time isn't available yet.
43-
now = None
4443
try:
45-
now_utc = time.localtime(esp.get_time()[0] + tz_offset)
44+
now = time.localtime(esp.get_time()[0] + tz_offset)
4645
except OSError:
4746
return False
4847
rtc.RTC().datetime = now
4948
return True
5049

50+
while not try_set_time(esp, TZ_OFFSET):
51+
time.sleep(0.01)
52+
5153
#######################################################################
5254
# Set the time, waiting until it's available
5355
#######################################################################

0 commit comments

Comments
 (0)