From fe4466bba1b092f3165b6db2e33d847bf1fa8c46 Mon Sep 17 00:00:00 2001 From: sunhaoyi Date: Thu, 23 May 2024 17:43:49 +0800 Subject: [PATCH] lib/tntimer: improve the judgement logic of timer setting timing time Signed-off-by: sunhaoyi --- lib/tntimer/tntimer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/tntimer/tntimer.c b/lib/tntimer/tntimer.c index a5f563fc..bb27ec10 100644 --- a/lib/tntimer/tntimer.c +++ b/lib/tntimer/tntimer.c @@ -87,8 +87,13 @@ systick_t tn_timer_next_tick(void) t = get_next_timer(); - if (t) + if (t) { + if (t->timeout_tick <= cur) { + return timoutListsOverflowed ? t->timeout_tick - cur + : 0; + } return t->timeout_tick - cur; + } return TICK_MAX; } -- Gitee