3.0.0 - Switch from ESP32SPI to native sockets
This release redoes this library to use native sockets and UDP to fetch the time. The API has drastically changed so make sure and update.
If you are using ESP32SPI still you can update the time directly with:
# with other imports
import rtc
# get_time will raise ValueError if the time isn't available yet so loop until
# it works.
now_utc = None
while now_utc is None:
try:
now_utc = time.localtime(esp.get_time()[0])
except ValueError:
pass
rtc.RTC().datetime = now_utc
To use in CircuitPython, simply install the Adafruit CircuitPython Bundle.
To use in CPython, pip3 install adafruit-circuitpython-ntp
.
Read the docs for info on how to use it.