Skip to content

Commit 48a2521

Browse files
authored
Merge pull request #11 from theelectricmayhem/patch-1
Changed tz_offset to seconds, updated docstring
2 parents c8ec219 + 1fe52b3 commit 48a2521

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

adafruit_ntp.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,15 @@
2525
2626
Network Time Protocol (NTP) helper for CircuitPython
2727
28-
29-
* Author(s): Brent Rubell
28+
* Author(s): Brent Rubell
3029
3130
Implementation Notes
3231
--------------------
33-
3432
**Hardware:**
35-
3633
**Software and Dependencies:**
3734
38-
* Adafruit CircuitPython firmware for the supported boards:
39-
https://github.com/adafruit/circuitpython/releases
35+
* Adafruit CircuitPython firmware for the supported boards:
36+
https://github.com/adafruit/circuitpython/releases
4037
4138
"""
4239
import time
@@ -65,11 +62,14 @@ def set_time(self, tz_offset=0):
6562
"""Fetches and sets the microcontroller's current time
6663
in seconds since since Jan 1, 1970.
6764
68-
:param int tz_offset: Timezone offset from GMT
65+
:param int tz_offset: The offset of the local timezone,
66+
in seconds west of UTC (negative in most of Western Europe,
67+
positive in the US, zero in the UK).
6968
"""
69+
7070
try:
7171
now = self._esp.get_time()
72-
now = time.localtime(now[0] + (tz_offset * 3600)) # 3600 seconds in an hour
72+
now = time.localtime(now[0] + tz_offset)
7373
rtc.RTC().datetime = now
7474
self.valid_time = True
7575
except ValueError as error:

0 commit comments

Comments
 (0)