hardbyte / hardbyte/python-can

Store timestamps in nanosecond precision

Open
#722 0 comments 2 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
1.6k
Forks
697
PR merge metrics
No merged PRs in 30d

Description

We currently store timestamps in float format while most interfaces and log formats use some integer representation. Converting these to floating point is a lossy operation.

My proposal is to add an additional `timestamp_ns` argument and attribute to the Message class. On initialization, if the `timestamp` argument is given it would be converted to ns. The `.timestamp` attribute can be dynamically calculated on get and set.

It would be fairly trivial to update the interfaces and log formats to use ns timestamps instead.

Contributor guide

Open the contributing guide

Research direction

Start by locating the Message class and reading how its timestamp is initialized, stored, and exposed. Then trace the interfaces and log formats mentioned in the proposal to identify every timestamp boundary. Done means nanosecond values remain lossless while existing timestamp access continues to work consistently across those interfaces and formats.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.