We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d125eac + 059aeeb commit c8ec219Copy full SHA for c8ec219
adafruit_ntp.py
@@ -61,14 +61,17 @@ def __init__(self, esp):
61
raise TypeError("Provided object is not an ESP_SPIcontrol object.")
62
self.valid_time = False
63
64
- def set_time(self):
+ def set_time(self, tz_offset=0):
65
"""Fetches and sets the microcontroller's current time
66
in seconds since since Jan 1, 1970.
67
+
68
+ :param int tz_offset: Timezone offset from GMT
69
"""
70
try:
71
now = self._esp.get_time()
- now = time.localtime(now[0])
72
+ now = time.localtime(now[0] + (tz_offset * 3600)) # 3600 seconds in an hour
73
rtc.RTC().datetime = now
74
self.valid_time = True
- except ValueError:
75
+ except ValueError as error:
76
+ print(str(error))
77
return
0 commit comments