Skip to content

Timezone missing error #119

@okvittem

Description

@okvittem

antfs-cli error message

TypeError: can't subtract offset-naive and offset-aware datetimes
is fixed by :

diff --git a/openant/fs/manager.py b/openant/fs/manager.py
index a5f3f3a..5e2c1e9 100644
--- a/openant/fs/manager.py
+++ b/openant/fs/manager.py
@@ -337,7 +337,7 @@ class Application:
         :param time: datetime in UTC, or None to set to current time
         """
         utc_tai_diff_seconds = 35
-        offset = time - datetime.datetime(1989, 12, 31, 0, 0, 0)
+        offset = time - datetime.datetime(1989, 12, 31, 0, 0, 0, tzinfo=datetime.timezone.utc)
         t = Time(int(offset.total_seconds()) + utc_tai_diff_seconds, 0xFFFFFFFF, 0)
         self._send_commandpipe(t.get())

This is openant 1.3.2 used by current Garmin-Forerunner-610-Extractor on linux Ubuntu 24.04.2 LTS
which refers to openant as 'ant' modules so that you need to do
ln -s openant ant
in the python library : /usr/local/lib/python3.12/dist-packages

The watch is a 910XT on Dynastream Innovations, Inc. ANTUSB2 Stick.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions