IXXAT: timestamps read 1.5 x wall time plus adapter uptime (misplaced parenthesis in _timeoffset; start tick never captured in vcinpl2)
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 88/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- python
- Bereich
- backend, networking
Rechercherichtung
Beginnen Sie in can/interfaces/ixxat/canlib_vcinpl.py bei etwa den Zeilen 629 und 705 und vergleichen Sie anschließend can/interfaces/ixxat/canlib_vcinpl2.py bei etwa den Zeilen 735 und 843. Konzentrieren Sie sich dabei auf die Einrichtung des Epoch-Offsets und die Behandlung von CAN_INFO_START. Führen Sie die bereitgestellte bus.recv-Reproduktion mit IXXAT-Datenverkehr aus und überprüfen Sie, dass die Zeitstempel mit time.time übereinstimmen, während der aus der Hardware abgeleitete Frame-Abstand unverändert bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Describe the bug
On the IXXAT backend every received Message.timestamp reads about 28 years in the future, plus the adapter's uptime. Measured on a USB-to-CAN V2 compact (VCI V4 driver 4.1.264.0, fd=False, python-can 4.6.1, Windows 11, Python 3.12): the first frame after Bus(interface="ixxat", channel=0, bitrate=500000) stamped 2684545240.8 while time.time() read 1789696744.2 — a ratio of 1.5000001. The excess over 1.5 * time.time() grew from 142.4 s to 146.5 s across two opens 4.1 s apart, i.e. it is the adapter's own tick counter since power-up, never rebased.
Two lines cause it, both present on main today:
-
A misplaced parenthesis in the epoch offset, in both backends:
can/interfaces/ixxat/canlib_vcinpl.pyline 629can/interfaces/ixxat/canlib_vcinpl2.pyline 735
self._timeoffset = start_begin + (start_end - start_begin / 2)This evaluates to
1.5 * start_begin + start_endinstead of the midpointstart_begin + (start_end - start_begin) / 2. Hence the 1.5 x wall-clock epoch. -
The start tick is never captured in
canlib_vcinpl2.py(line 843): theCAN_INFO_STARTcheck is anelifsibling of theCAN_MSGTYPE_INFObranch rather than nested inside it, so an INFO message is consumed by the firstelifand_starttickoffsetstays0. Every timestamp then carries the adapter's uptime.canlib_vcinpl.pyonmainhas this check nested correctly (line 705); the FD backend does not.elif self._message.uMsgInfo.Bits.type == constants.CAN_MSGTYPE_INFO: log.info(...) # Handle CAN start info message elif self._message.abData[0] == constants.CAN_INFO_START: # never reached for INFO messages self._starttickoffset = self._message.dwTime
The spacing between frames is correct and hardware-derived (10.014 s of frame time against 10.014 s of wall time over 10 s, never a step backwards, 9 µs resolution), so this is purely the epoch.
To Reproduce
import time, can
bus = can.Bus(interface="ixxat", channel=0, bitrate=500000)
msg = bus.recv(5)
print(msg.timestamp, time.time(), msg.timestamp / time.time())
# 2684545240.8 1789696744.2 1.5000001
Any bus with traffic reproduces it; the ratio of timestamp / time.time() is 1.5 rather than 1.0.
Expected behaviour
Message.timestamp should be Unix time to within the open call, as the other backends provide, with the adapter's own tick spacing preserved.
Additional context
- python-can 4.6.1 (also present on
mainat the lines cited above) - IXXAT USB-to-CAN V2 compact, HMS VCI V4 4.1.264.0, Windows 11, Python 3.12
- Working around it downstream by adding one constant settled from the first frame's arrival when the bus's offset lies outside the open call; happy to open a PR for the two one-line fixes if that is welcome.
- Vorherrschende Sprache
- Python
- Sterne
- 1.6k
- Forks
- 697
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus hardbyte/python-can
-
bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 78/100
hardbyte/python-can#2077 · 1 Kommentar · 1 Reaktion ·
-
bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 68/100
hardbyte/python-can#1922 · 1 Reaktion ·
-
enhancement
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 75/100
hardbyte/python-can#2104 ·
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 30/100
hardbyte/python-can#2102 ·
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
hardbyte/python-can#2092 ·
Alle Issues in hardbyte/python-can
Ähnliche Issues
-
bug status/needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 86/100
prowler-cloud/prowler#12887 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
area: desktop platform: macos priority: p3 status: ready type: enhancement
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 92/100
use-agent-os/agent-os#3484 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 86/100
open-telemetry/opentelemetry-python-contrib#5113 · 2 Kommentare · 2 Reaktionen ·
Maintainer antworten meist innerhalb von 1 Tag
-
external
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
langchain-ai/docs#6255 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag