Skip to content

Commit 3ca85dc

Browse files
committed
word_clock.py: handle failure to get time from ntptime
1 parent e3777b3 commit 3ca85dc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

examples/word_clock.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ def show_message(text):
5151
show_message(e)
5252

5353
# Set the correct time using the NTP service.
54-
ntptime.settime()
54+
try:
55+
ntptime.settime()
56+
except OSError:
57+
while True:
58+
show_message("Unable to get time.\n\nCheck your network try again.")
5559

5660

5761
def approx_time(hours, minutes):

0 commit comments

Comments
 (0)