Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix timestamp inconsistencies between Windows and Linux #459

Conversation

TedRio
Copy link
Contributor

@TedRio TedRio commented Feb 28, 2024

No description provided.

Copy link

codecov bot commented Feb 28, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 98.13%. Comparing base (a42daaf) to head (e660546).

Files Patch % Lines
...c/pykiso/lib/connectors/cc_pcan_can/cc_pcan_can.py 66.66% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #459      +/-   ##
==========================================
- Coverage   98.17%   98.13%   -0.05%     
==========================================
  Files          84       84              
  Lines        6699     6707       +8     
==========================================
+ Hits         6577     6582       +5     
- Misses        122      125       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +37 to +46
try:
# use to avoid timestamp inconsistances between pykiso and python can
import uptime

if uptime.boottime() is None:
boottime_epoch = 0
else:
boottime_epoch = uptime.boottime().timestamp()
except ImportError:
boottime_epoch = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
try:
# use to avoid timestamp inconsistances between pykiso and python can
import uptime
if uptime.boottime() is None:
boottime_epoch = 0
else:
boottime_epoch = uptime.boottime().timestamp()
except ImportError:
boottime_epoch = 0
boottime_epoch = 0
try:
# use to avoid timestamp inconsistances between pykiso and python can in linux
import uptime
if not uptime.boottime():
boottime_epoch = uptime.boottime().timestamp()
except:
pass

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally find it more explicit to set it to 0 in all failing cases

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also like the fact that we don't catch all errors

@sebclrsn sebclrsn merged commit 013cbe9 into eclipse:master Mar 4, 2024
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants