From dcd4d12c0ab55aea50fc93f4de390a815d4ff6f5 Mon Sep 17 00:00:00 2001 From: Joseph Bryant Date: Sun, 18 Aug 2024 21:50:41 +0100 Subject: [PATCH] avoid delta overflow in countdown draw --- movement/watch_faces/complication/countdown_face.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/movement/watch_faces/complication/countdown_face.c b/movement/watch_faces/complication/countdown_face.c index be04040..6ae3d93 100644 --- a/movement/watch_faces/complication/countdown_face.c +++ b/movement/watch_faces/complication/countdown_face.c @@ -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);