mirror of
https://github.com/firewalkwithm3/Sensor-Watch.git
synced 2024-11-22 11:10:29 +08:00
avoid delta overflow in countdown draw
This commit is contained in:
parent
0ad5fa4733
commit
dcd4d12c0a
|
@ -87,7 +87,10 @@ static void draw(countdown_state_t *state, uint8_t subsecond) {
|
|||
|
||||
switch (state->mode) {
|
||||
case cd_running:
|
||||
delta = state->target_ts - state->now_ts;
|
||||
if (state->target_ts <= state->now_ts)
|
||||
delta = 0;
|
||||
else
|
||||
delta = state->target_ts - state->now_ts;
|
||||
result = div(delta, 60);
|
||||
state->seconds = result.rem;
|
||||
result = div(result.quot, 60);
|
||||
|
|
Loading…
Reference in a new issue