This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 038720c350c2b2136611ae43e825625549d3c485
Author: ouyangxiangzhen <[email protected]>
AuthorDate: Tue Mar 24 20:08:39 2026 +0800

    sched/wdog: unify delay calculation style in wd_timer_start
    
    Restructure the passed-deadline delay computation in wd_timer_start()
    to use an explicit delay variable and align the code style with the
    surrounding code, improving readability.  The behavior is unchanged:
    an expired or equal deadline still yields a zero delay (matching what
    upstream 37ccc03 already provides for a passed deadline).
    
    Assisted-By: mimo-v2.6-pro
    Signed-off-by: ouyangxiangzhen <[email protected]>
---
 sched/wdog/wdog.h | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sched/wdog/wdog.h b/sched/wdog/wdog.h
index 78ce793ecfc..a045ba6506c 100644
--- a/sched/wdog/wdog.h
+++ b/sched/wdog/wdog.h
@@ -176,11 +176,9 @@ static inline_function void wd_timer_start(clock_t tick, 
bool in_expiration)
 #ifdef CONFIG_SCHED_TICKLESS_ALARM
   up_alarm_tick_start(next_tick);
 #else
-  clock_t now = clock_systime_ticks();
-
-  /* A passed deadline must fire now: timers may read the delay unsigned */
-
-  up_timer_tick_start(clock_compare(next_tick, now) ? 0 : next_tick - now);
+  clock_t now   = clock_systime_ticks();
+  clock_t delay = clock_compare(now, next_tick) ? next_tick - now : 0;
+  up_timer_tick_start(delay);
 #endif
 }
 

Reply via email to