From af00d87caa21a2f5e2b9fd75dc1101dbf9333b20 Mon Sep 17 00:00:00 2001 From: Joshua Date: Mon, 3 Jul 2023 15:21:07 +0930 Subject: [PATCH 1/2] Fixed incorrect type definition for tz_offset parameter. --- adafruit_ntp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_ntp.py b/adafruit_ntp.py index 43a9326..8bcd23a 100644 --- a/adafruit_ntp.py +++ b/adafruit_ntp.py @@ -40,7 +40,7 @@ def __init__( *, server: str = "0.adafruit.pool.ntp.org", port: int = 123, - tz_offset: int = 0, + tz_offset: float = 0, socket_timeout: int = 10, ) -> None: """ From bc06b62e76808813072dd5da15acda8ae0b59d34 Mon Sep 17 00:00:00 2001 From: Joshua Date: Mon, 3 Jul 2023 22:30:11 +0930 Subject: [PATCH 2/2] Converted seconds offset to integer to eliminate rounding errors. --- adafruit_ntp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_ntp.py b/adafruit_ntp.py index 8bcd23a..b405402 100644 --- a/adafruit_ntp.py +++ b/adafruit_ntp.py @@ -56,7 +56,7 @@ def __init__( self._server = server self._port = port self._packet = bytearray(48) - self._tz_offset = tz_offset * 60 * 60 + self._tz_offset = int(tz_offset * 60 * 60) self._socket_timeout = socket_timeout # This is our estimated start time for the monotonic clock. We adjust it based on the ntp