-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Correct millis() drift, issue #3078 #4264
Conversation
Thanks for putting together this fix and the great explanation! |
@igrr I think the exhaustive testing of the calculation accuracy was done host side, so it should be possible to do something similar for a test here. |
I was referring to the performance benchmark (time spent in a call to |
@igrr and @devyte After some study, I believe I can manage the device test. I have (2) questions:
|
Yes, you should be able to use printf statements inside the test case. You can simply push more commits to your mrwgx3_millis_corr branch, and they will be visible in this PR. You don't need to create a separate PR for the tests. |
you ran this test for the year!? wow :) |
@mrwgx3 there seems to be a warning on compile. Could you please fix that? I'll merge then. |
Hi @devyte |
@mrwgx3 You'll need to enable all warnings in the ide to see them. Here's the relevant snippet from the logs:
|
Thank you, @earlephilhower. |
Add union 'acc' in millis() to eliminate 'punning' compiler warning
Add union 'acc' to eliminate 'punning' compiler warning in 'millis_test'_DEBUG() and 'millis_test()'
Hi @devyte and @earlephilhower Make requested corrections to eliminate 'punning' warnings to files Hope this solves the problem |
* Correct millis() drift, issue 3078 * Add 'test_millis_mm.ino' runtime benchmark * Eliminate 'punning' warning Add union 'acc' in millis() to eliminate 'punning' compiler warning * Correct minor typo * Eliminate 'punning' warning Add union 'acc' to eliminate 'punning' compiler warning in 'millis_test'_DEBUG() and 'millis_test()' (cherry picked from commit 3934d10)
This pull-request corrects the cumlative (296us / usec overflow) drift seen in the orignal 'millis()' function. Extensive comments are included.