Skip to content

Commit a71a9c1

Browse files
committed
Stop using NTP library and get time directly
from the ESP library.
1 parent 5af7710 commit a71a9c1

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

adafruit_gc_iot_core.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
import adafruit_logging as logging
3232
from adafruit_jwt import JWT
33+
import rtc
3334

3435
__version__ = "0.0.0-auto.0"
3536
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_GC_IOT_Core.git"
@@ -353,14 +354,7 @@ def generate_jwt(self, ttl=43200, algo="RS256"):
353354
self.logger.debug("Generating JWT...")
354355

355356
if self._esp is not None:
356-
# Not all boards have ESP access easily (eg: featherS2).
357-
# If we pass in a False or None in init, lets
358-
# assume that we've handled setting the RTC outside of here
359-
# pylint: disable=import-outside-toplevel
360-
import adafruit_ntp as NTP
361-
362-
ntp = NTP.NTP(self._esp)
363-
ntp.set_time()
357+
rtc.RTC().datetime = time.localtime(self._esp.get_time()[0])
364358
else:
365359
if self.logger:
366360
self.logger.info(

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# Uncomment the below if you use native CircuitPython modules such as
2525
# digitalio, micropython and busio. List the modules you use. Without it, the
2626
# autodoc module docs will fail to generate with a warning.
27-
autodoc_mock_imports = ["adafruit_logging", "adafruit_jwt", "adafruit_ntp", "rtc"]
27+
autodoc_mock_imports = ["adafruit_logging", "adafruit_jwt", "rtc"]
2828

2929
intersphinx_mapping = {
3030
"python": ("https://docs.python.org/3", None),

0 commit comments

Comments
 (0)