-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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 AdvancedWebServer.ino uptime conversion #9224
Conversation
👋 Hello cydanil, we appreciate your contribution to this project! Click to see more instructions ...
Review and merge process you can expect ...
|
libraries/WebServer/examples/AdvancedWebServer/AdvancedWebServer.ino
Outdated
Show resolved
Hide resolved
int hr = min / 60; | ||
int hr = sec / 3600; | ||
int min = (sec / 60) % 60; | ||
sec = sec % 60 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing ;
at the end of the line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW looking at the code below, both min
and sec
are % 60
, which makes the new code in effect the same as the old one. Also the old one looks OK, so I wonder how come you got the wrong values?
Description of Change
This PR resolves an insignificant bug in the
AdvancedWebServer.ino
example, where the uptime is converted from seconds to hours, minutes, seconds format.The changes do not affect the overall sketch nor its intended usage.
Prior to the changes, the reported uptime would be incorrectly going over 60 seconds a minute, and minutes would increase incorrectly.
For examples:
After these changes, minutes and seconds update as expected.
Tests scenarios
I have tested my Pull Request on Arduino-esp32 core
v2.0.14
with ESP32 on anESP32-Ethernet-Kit_A_V1.2
development board.Thank you for your time,
Cyril 🙂