File tree 1 file changed +7
-7
lines changed
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 48
48
49
49
class NTP :
50
50
"""Network Time Protocol (NTP) helper module for CircuitPython.
51
- This module does not handle daylight savings time.
51
+ This module does not handle daylight savings or local time.
52
52
53
53
:param adafruit_esp32spi esp: ESP32SPI object.
54
54
"""
@@ -63,15 +63,15 @@ def __init__(self, esp):
63
63
64
64
def set_time (self , tz_offset = 0 ):
65
65
"""Fetches and sets the microcontroller's current time
66
- in seconds since since Jan 1, 1970. Optionally offsets
67
- the current time to that of the requested timezone.
68
-
69
- :param int tz_offset: Timezone offset from GMT in hours
66
+ in seconds since since Jan 1, 1970.
67
+
68
+ :param int tz_offset: Timezone offset from GMT
70
69
"""
71
70
try :
72
71
now = self ._esp .get_time ()
73
- now = time .localtime (now [0 ]+ (tz_offset * 3600 )) # 3600 seconds in an hour
72
+ now = time .localtime (now [0 ] + (tz_offset * 3600 )) # 3600 seconds in an hour
74
73
rtc .RTC ().datetime = now
75
74
self .valid_time = True
76
- except ValueError :
75
+ except ValueError as error :
76
+ print (str (error ))
77
77
return
You can’t perform that action at this time.
0 commit comments