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

Handle millis overflow during running state #80

Merged
merged 3 commits into from
Oct 13, 2021

Conversation

boraozgen
Copy link
Contributor

@boraozgen boraozgen commented Oct 8, 2021

If millis overflowed during running state, now < time_start_ always returned true and hanged the library. This change uses the signed integer trick to handle the overflow situation.

For this to work, millis must overflow at 32-bits. I updated the Mbed OS millis implementation to use the latest version to ensure this.

@jandelgado
Copy link
Owner

jandelgado commented Oct 11, 2021

Hi, thanks for the fix. Could you also add a unit test that checks the behaviour?

For the curious, some background: https://arduino.stackexchange.com/questions/12587/how-can-i-handle-the-millis-rollover/12588#12588

@boraozgen
Copy link
Contributor Author

Done, I also found another problematic line while writing the tests (L.402) and fixed it too.

If millis overflowed during running state, now < time_start_
always returned true and hanged the library. This change
uses the signed integer trick to handle the overflow situation.
@coveralls
Copy link

coveralls commented Oct 13, 2021

Coverage Status

Coverage remained the same at 96.875% when pulling b448e76 on boraozgen:handle-millis-overflow into 6ebb7fc on jandelgado:master.

@jandelgado jandelgado merged commit d3cb72e into jandelgado:master Oct 13, 2021
@boraozgen boraozgen deleted the handle-millis-overflow branch October 13, 2021 11:43
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

3 participants