PCAN message timestamps drift after macOS system sleep
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 68/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- python
- Domaine
- embedded-iot
Piste de recherche
Commencez par le calcul des horodatages de PcanBus et reproduisez le test contrôlé de mise en veille de macOS avec un adaptateur PCAN. Vérifiez que les horodatages des messages CAN reçus restent alignés sur l'heure de l'horloge murale après le réveil, avant le writer BLF ou le convertisseur CSV, et que la reconnexion de l'adaptateur n'affecte pas le résultat.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Describe the bug
On macOS, CAN message timestamps from PcanBus drift behind the current wall-clock time after the computer sleeps.
PcanBus combines the Mac boot time with a PCAN elapsed-time counter. The counter pauses while macOS sleeps, so every sleep cycle increases the timestamp error.
The incorrect timestamp is produced before BLF or CSV logging. Both log formats preserve the timestamp received from python-can.
To Reproduce
- Connect a PCAN adapter on macOS.
- Start receiving CAN messages and record their timestamps.
- Put the Mac to sleep, then wake it.
- Receive another CAN message.
- Compare its timestamp with the current wall-clock time.
The CAN timestamp will be behind the wall clock by approximately the amount of time the Mac spent asleep.
Unplugging and reconnecting the PCAN adapter does not reset the drift.
Expected behavior
CAN message timestamps should match the current wall-clock time after the Mac wakes from sleep.
System sleep should not cause timestamps to drift backward.
Additional context
OS and version: macOS 26.5.1, build 25F80
Python version: 3.13.14
python-can version: 4.6.1
python-can interface/s: pcan via PCAN/MacCAN
The issue has been confirmed on macOS. Potential impact on Windows has not been tested.
Traceback and logs
No exception is raised. The problem appears in the timestamps assigned to received CAN messages.During a controlled sleep test:
Wall-clock elapsed time: 73.6 seconds
PCAN elapsed counter: 60.9 seconds
Difference: 12.7 seconds
Recorded macOS sleep: 12.7 seconds
The difference between the wall clock and PCAN counter matched the macOS sleep duration.
The incorrect timestamps were present before reaching the BLF writer and CSV converter, so those components were ruled out.
Disconnecting the PCAN adapter for 60 seconds did not reset the elapsed counter or correct the timestamp.
- Langage dominant
- Python
- Étoiles
- 1.6k
- Forks
- 697
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de hardbyte/python-can
-
bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 78/100
hardbyte/python-can#2077 · 1 commentaire · 1 réaction ·
-
bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 68/100
hardbyte/python-can#1922 · 1 réaction ·
-
enhancement
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 30/100
hardbyte/python-can#2102 ·
-
bug
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
hardbyte/python-can#2091 ·
-
`BitTiming.from_sample_point` rejects valid timing solutions due to hardcoded register limits Ouvertebug
Difficulté 3/5 1-2 jours Accessibilité débutants 72/100
hardbyte/python-can#2083 ·
Toutes les issues de hardbyte/python-can
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100