adafruit / Adafruit_CircuitPython_NTP

Network Time Protocol (NTP) Helper for CircuitPython
MIT License
9 stars 18 forks source link

Fix invalid get_time calls #3

Closed brentru closed 4 years ago

brentru commented 4 years ago

Adding a valid_time property for set_time calls from user-code to detect error raised by ESP32SPI (https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/pull/73)

Addresses issue: https://github.com/adafruit/Adafruit_CircuitPython_NTP/issues/2

Tested on Adafruit CircuitPython 4.1.0 on 2019-08-02; Adafruit Metro M4 Airlift Lite with samd51j19

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Connecting to AP...
Failed to obtain time, retrying in 5 seconds...
Failed to obtain time, retrying in 5 seconds...
Seconds since Jan 1, 1970: 1569422698 seconds
struct_time(tm_year=2019, tm_mon=9, tm_mday=25, tm_hour=14, tm_min=44, tm_sec=58, tm_wday=2, tm_yday=268, tm_isdst=-1)
It is currently 9/25/2019 at 14:44:58 UTC
brentru commented 4 years ago

@jerryneedell Thanks for testing, merging in.