Skip to content

Commit 80ff5b5

Browse files
Changed tz_offset to seconds, updated docstring
1 parent 059aeeb commit 80ff5b5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

adafruit_ntp.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,13 @@ def set_time(self, tz_offset=0):
6565
"""Fetches and sets the microcontroller's current time
6666
in seconds since since Jan 1, 1970.
6767
68-
:param int tz_offset: Timezone offset from GMT
68+
:param int tz_offset: The offset of the local timezone,
69+
in seconds west of UTC (negative in most of Western Europe,
70+
positive in the US, zero in the UK).
6971
"""
7072
try:
7173
now = self._esp.get_time()
72-
now = time.localtime(now[0] + (tz_offset * 3600)) # 3600 seconds in an hour
74+
now = time.localtime(now[0] + tz_offset)
7375
rtc.RTC().datetime = now
7476
self.valid_time = True
7577
except ValueError as error:

0 commit comments

Comments
 (0)