We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents c28977f + 32f15ce commit 424c489Copy full SHA for 424c489
adafruit_esp32spi/adafruit_esp32spi.py
@@ -766,7 +766,10 @@ def get_time(self):
766
"""The current unix timestamp"""
767
if self.status == WL_CONNECTED:
768
resp = self._send_command_get_response(_GET_TIME)
769
- return struct.unpack('<i', resp[0])
+ resp_time = struct.unpack('<i', resp[0])
770
+ if resp_time == (0,):
771
+ raise ValueError("_GET_TIME returned 0")
772
+ return resp_time
773
if self.status in (WL_AP_LISTENING, WL_AP_CONNECTED):
774
raise RuntimeError("Cannot obtain NTP while in AP mode, must be connected to internet")
775
raise RuntimeError("Must be connected to WiFi before obtaining NTP.")
0 commit comments