From 80ff5b556f47f78aa0cc0f43ded160c4ab76c94a Mon Sep 17 00:00:00 2001 From: Jesse <51097226+theelectricmayhem@users.noreply.github.com> Date: Tue, 12 May 2020 16:19:41 -0600 Subject: [PATCH 01/15] Changed tz_offset to seconds, updated docstring --- adafruit_ntp.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/adafruit_ntp.py b/adafruit_ntp.py index 1a4a27a..f11bcff 100644 --- a/adafruit_ntp.py +++ b/adafruit_ntp.py @@ -65,11 +65,13 @@ def set_time(self, tz_offset=0): """Fetches and sets the microcontroller's current time in seconds since since Jan 1, 1970. - :param int tz_offset: Timezone offset from GMT + :param int tz_offset: The offset of the local timezone, + in seconds west of UTC (negative in most of Western Europe, + positive in the US, zero in the UK). """ try: now = self._esp.get_time() - now = time.localtime(now[0] + (tz_offset * 3600)) # 3600 seconds in an hour + now = time.localtime(now[0] + tz_offset) rtc.RTC().datetime = now self.valid_time = True except ValueError as error: From 8ab96a1772048f27d359b235110757dc43539113 Mon Sep 17 00:00:00 2001 From: Jesse McKenna <51097226+theelectricmayhem@users.noreply.github.com> Date: Thu, 14 May 2020 20:56:52 -0600 Subject: [PATCH 02/15] Added newline to doctoring to make Sphinx happy --- adafruit_ntp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/adafruit_ntp.py b/adafruit_ntp.py index f11bcff..840e228 100644 --- a/adafruit_ntp.py +++ b/adafruit_ntp.py @@ -69,6 +69,7 @@ def set_time(self, tz_offset=0): in seconds west of UTC (negative in most of Western Europe, positive in the US, zero in the UK). """ + try: now = self._esp.get_time() now = time.localtime(now[0] + tz_offset) From 772dab6ec6ec886be99ad77f8e0037e4377119c4 Mon Sep 17 00:00:00 2001 From: Jesse McKenna <51097226+theelectricmayhem@users.noreply.github.com> Date: Thu, 14 May 2020 21:03:58 -0600 Subject: [PATCH 03/15] Black reformatting --- adafruit_ntp.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/adafruit_ntp.py b/adafruit_ntp.py index 840e228..be15035 100644 --- a/adafruit_ntp.py +++ b/adafruit_ntp.py @@ -22,22 +22,14 @@ """ `adafruit_ntp` ================================================================================ - Network Time Protocol (NTP) helper for CircuitPython - - * Author(s): Brent Rubell - Implementation Notes -------------------- - **Hardware:** - **Software and Dependencies:** - * Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases - """ import time import rtc @@ -49,7 +41,6 @@ class NTP: """Network Time Protocol (NTP) helper module for CircuitPython. This module does not handle daylight savings or local time. - :param adafruit_esp32spi esp: ESP32SPI object. """ @@ -64,12 +55,11 @@ def __init__(self, esp): def set_time(self, tz_offset=0): """Fetches and sets the microcontroller's current time in seconds since since Jan 1, 1970. - :param int tz_offset: The offset of the local timezone, in seconds west of UTC (negative in most of Western Europe, positive in the US, zero in the UK). """ - + try: now = self._esp.get_time() now = time.localtime(now[0] + tz_offset) From 91a842e5268f35cb6d61d4e4b76b563de91b8909 Mon Sep 17 00:00:00 2001 From: Jesse McKenna <51097226+theelectricmayhem@users.noreply.github.com> Date: Thu, 14 May 2020 21:14:23 -0600 Subject: [PATCH 04/15] Adjusted doctoring formatting --- adafruit_ntp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_ntp.py b/adafruit_ntp.py index be15035..7e59850 100644 --- a/adafruit_ntp.py +++ b/adafruit_ntp.py @@ -55,7 +55,7 @@ def __init__(self, esp): def set_time(self, tz_offset=0): """Fetches and sets the microcontroller's current time in seconds since since Jan 1, 1970. - :param int tz_offset: The offset of the local timezone, + :param tz_offset: The offset of the local timezone, in seconds west of UTC (negative in most of Western Europe, positive in the US, zero in the UK). """ From 4687467eff151544d7b9a54dc4fc4063a5a7071e Mon Sep 17 00:00:00 2001 From: Jesse McKenna <51097226+theelectricmayhem@users.noreply.github.com> Date: Thu, 14 May 2020 21:22:58 -0600 Subject: [PATCH 05/15] Feeding the sphinx --- adafruit_ntp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/adafruit_ntp.py b/adafruit_ntp.py index 7e59850..c3f87ef 100644 --- a/adafruit_ntp.py +++ b/adafruit_ntp.py @@ -55,6 +55,7 @@ def __init__(self, esp): def set_time(self, tz_offset=0): """Fetches and sets the microcontroller's current time in seconds since since Jan 1, 1970. + :param tz_offset: The offset of the local timezone, in seconds west of UTC (negative in most of Western Europe, positive in the US, zero in the UK). From 7159045a81e27678148bb5eeb698992349ee53fa Mon Sep 17 00:00:00 2001 From: Jesse McKenna <51097226+theelectricmayhem@users.noreply.github.com> Date: Thu, 14 May 2020 21:50:06 -0600 Subject: [PATCH 06/15] Moved all :param text to single line. --- adafruit_ntp.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/adafruit_ntp.py b/adafruit_ntp.py index c3f87ef..2d5e1b0 100644 --- a/adafruit_ntp.py +++ b/adafruit_ntp.py @@ -56,9 +56,7 @@ def set_time(self, tz_offset=0): """Fetches and sets the microcontroller's current time in seconds since since Jan 1, 1970. - :param tz_offset: The offset of the local timezone, - in seconds west of UTC (negative in most of Western Europe, - positive in the US, zero in the UK). + :param int tz_offset: The offset of the local timezone, in seconds west of UTC (negative in most of Western Europe, positive in the US, zero in the UK). """ try: From afcd3d9b5612151371d0c012dc5f3583048538f9 Mon Sep 17 00:00:00 2001 From: Jesse McKenna <51097226+theelectricmayhem@users.noreply.github.com> Date: Thu, 14 May 2020 22:01:51 -0600 Subject: [PATCH 07/15] Indented multi-line parameter description --- adafruit_ntp.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/adafruit_ntp.py b/adafruit_ntp.py index 2d5e1b0..927be29 100644 --- a/adafruit_ntp.py +++ b/adafruit_ntp.py @@ -56,7 +56,9 @@ def set_time(self, tz_offset=0): """Fetches and sets the microcontroller's current time in seconds since since Jan 1, 1970. - :param int tz_offset: The offset of the local timezone, in seconds west of UTC (negative in most of Western Europe, positive in the US, zero in the UK). + :param int tz_offset: The offset of the local timezone, + in seconds west of UTC (negative in most of Western Europe, + positive in the US, zero in the UK). """ try: From 0aab120614699e3c8cf4b058a57e2c32a5830973 Mon Sep 17 00:00:00 2001 From: Jesse McKenna <51097226+theelectricmayhem@users.noreply.github.com> Date: Thu, 14 May 2020 22:04:18 -0600 Subject: [PATCH 08/15] Removed newline --- adafruit_ntp.py | 1 - 1 file changed, 1 deletion(-) diff --git a/adafruit_ntp.py b/adafruit_ntp.py index 927be29..3098bae 100644 --- a/adafruit_ntp.py +++ b/adafruit_ntp.py @@ -55,7 +55,6 @@ def __init__(self, esp): def set_time(self, tz_offset=0): """Fetches and sets the microcontroller's current time in seconds since since Jan 1, 1970. - :param int tz_offset: The offset of the local timezone, in seconds west of UTC (negative in most of Western Europe, positive in the US, zero in the UK). From ee2e2df25732564f2c70d5cd94b94e74311b5ca1 Mon Sep 17 00:00:00 2001 From: Jesse McKenna <51097226+theelectricmayhem@users.noreply.github.com> Date: Thu, 14 May 2020 22:15:46 -0600 Subject: [PATCH 09/15] Adjusted indentation of the GitHub CircuitPython releases link --- adafruit_ntp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_ntp.py b/adafruit_ntp.py index 3098bae..cb4cdf5 100644 --- a/adafruit_ntp.py +++ b/adafruit_ntp.py @@ -29,7 +29,7 @@ **Hardware:** **Software and Dependencies:** * Adafruit CircuitPython firmware for the supported boards: - https://github.com/adafruit/circuitpython/releases + https://github.com/adafruit/circuitpython/releases """ import time import rtc From 2d9b75286a85cd2655aed83e75d358260121473f Mon Sep 17 00:00:00 2001 From: Jesse McKenna <51097226+theelectricmayhem@users.noreply.github.com> Date: Thu, 14 May 2020 22:26:49 -0600 Subject: [PATCH 10/15] Added trailing newline to param description --- adafruit_ntp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/adafruit_ntp.py b/adafruit_ntp.py index cb4cdf5..945cb15 100644 --- a/adafruit_ntp.py +++ b/adafruit_ntp.py @@ -58,6 +58,7 @@ def set_time(self, tz_offset=0): :param int tz_offset: The offset of the local timezone, in seconds west of UTC (negative in most of Western Europe, positive in the US, zero in the UK). + """ try: From bdeb3a1ccc8048e1f5b6a660ee6697da94030b66 Mon Sep 17 00:00:00 2001 From: FoamyGuy Date: Fri, 19 Jun 2020 21:21:26 -0500 Subject: [PATCH 11/15] try to fix pylint whitespace issue --- adafruit_ntp.py | 1 - 1 file changed, 1 deletion(-) diff --git a/adafruit_ntp.py b/adafruit_ntp.py index 945cb15..cb4cdf5 100644 --- a/adafruit_ntp.py +++ b/adafruit_ntp.py @@ -58,7 +58,6 @@ def set_time(self, tz_offset=0): :param int tz_offset: The offset of the local timezone, in seconds west of UTC (negative in most of Western Europe, positive in the US, zero in the UK). - """ try: From 1bf43464ec94c0067f8a8ac5094bebe532cc0bbf Mon Sep 17 00:00:00 2001 From: FoamyGuy Date: Fri, 19 Jun 2020 21:31:40 -0500 Subject: [PATCH 12/15] try to fix docs unexpected indention --- adafruit_ntp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/adafruit_ntp.py b/adafruit_ntp.py index cb4cdf5..1e6bfa1 100644 --- a/adafruit_ntp.py +++ b/adafruit_ntp.py @@ -55,6 +55,7 @@ def __init__(self, esp): def set_time(self, tz_offset=0): """Fetches and sets the microcontroller's current time in seconds since since Jan 1, 1970. + :param int tz_offset: The offset of the local timezone, in seconds west of UTC (negative in most of Western Europe, positive in the US, zero in the UK). From 00f90c6ffdcfe0d87b7f0605ed5c46905c822a63 Mon Sep 17 00:00:00 2001 From: FoamyGuy Date: Fri, 19 Jun 2020 21:37:32 -0500 Subject: [PATCH 13/15] try to fix docs unexpected indention some more --- adafruit_ntp.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/adafruit_ntp.py b/adafruit_ntp.py index 1e6bfa1..6557eb6 100644 --- a/adafruit_ntp.py +++ b/adafruit_ntp.py @@ -22,14 +22,17 @@ """ `adafruit_ntp` ================================================================================ + Network Time Protocol (NTP) helper for CircuitPython * Author(s): Brent Rubell + Implementation Notes -------------------- **Hardware:** **Software and Dependencies:** * Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases + """ import time import rtc @@ -41,6 +44,7 @@ class NTP: """Network Time Protocol (NTP) helper module for CircuitPython. This module does not handle daylight savings or local time. + :param adafruit_esp32spi esp: ESP32SPI object. """ From 71c87a38dcb0506e6e21185ff434f693b8302aeb Mon Sep 17 00:00:00 2001 From: FoamyGuy Date: Fri, 19 Jun 2020 21:42:08 -0500 Subject: [PATCH 14/15] try to fix docs unexpected indention, out of ideas if this doesn't work --- adafruit_ntp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_ntp.py b/adafruit_ntp.py index 6557eb6..565658b 100644 --- a/adafruit_ntp.py +++ b/adafruit_ntp.py @@ -31,7 +31,7 @@ **Hardware:** **Software and Dependencies:** * Adafruit CircuitPython firmware for the supported boards: - https://github.com/adafruit/circuitpython/releases + https://github.com/adafruit/circuitpython/releases """ import time From 1fe52b3b7c9797208cb3f7580e7b889a20db1799 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 20 Jun 2020 06:35:31 -0500 Subject: [PATCH 15/15] Fix doc build --- adafruit_ntp.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/adafruit_ntp.py b/adafruit_ntp.py index 565658b..6297ebf 100644 --- a/adafruit_ntp.py +++ b/adafruit_ntp.py @@ -24,14 +24,16 @@ ================================================================================ Network Time Protocol (NTP) helper for CircuitPython -* Author(s): Brent Rubell + + * Author(s): Brent Rubell Implementation Notes -------------------- **Hardware:** **Software and Dependencies:** -* Adafruit CircuitPython firmware for the supported boards: - https://github.com/adafruit/circuitpython/releases + + * Adafruit CircuitPython firmware for the supported boards: + https://github.com/adafruit/circuitpython/releases """ import time