From 81b97b676bab4eebd9b0d37c705499d528aaa570 Mon Sep 17 00:00:00 2001 From: yangguangcai Date: Mon, 19 Aug 2024 15:37:42 +0800 Subject: [PATCH] timer_settime:fix set time when flag is TIMER_ABSTIME. Signed-off-by: yangguangcai --- sched/timer/timer_settime.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sched/timer/timer_settime.c b/sched/timer/timer_settime.c index 866d8d58bd..dd08d12956 100644 --- a/sched/timer/timer_settime.c +++ b/sched/timer/timer_settime.c @@ -305,7 +305,9 @@ int timer_settime(timer_t timerid, int flags, { /* Calculate a delay corresponding to the absolute time in 'value' */ - timer->pt_expected = clock_time2ticks(&value->it_value); + clock_abstime2ticks(timer->pt_clock, &value->it_value, + &timer->pt_expected); + timer->pt_expected += clock_systime_ticks(); } else {