You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/07/18 04:30:34 UTC

[incubator-nuttx] branch master updated: sched/timer: timer_settime not fully satisfy IEEE 1003.1

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 2721e01fc2 sched/timer: timer_settime not fully satisfy IEEE 1003.1
2721e01fc2 is described below

commit 2721e01fc20da038107767eab23374a6ca5b9147
Author: larry <la...@transtekcorp.com>
AuthorDate: Sat Jul 16 08:46:05 2022 +0800

    sched/timer: timer_settime not fully satisfy IEEE 1003.1
    
    If the specified time has already passed, the function
    shall succeed and the expiration notification shall be made.
---
 sched/timer/timer_settime.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sched/timer/timer_settime.c b/sched/timer/timer_settime.c
index 7f0a398a9d..7ee035c5c4 100644
--- a/sched/timer/timer_settime.c
+++ b/sched/timer/timer_settime.c
@@ -306,18 +306,18 @@ int timer_settime(timer_t timerid, int flags,
       goto errout;
     }
 
-  /* If the time is in the past or now, then set up the next interval
-   * instead (assuming a repetitive timer).
+  /* If the specified time has already passed, the function shall succeed
+   * and the expiration notification shall be made.
    */
 
-  if (delay <= 0)
+  if (delay < 0)
     {
-      delay = timer->pt_delay;
+      delay = 0;
     }
 
   /* Then start the watchdog */
 
-  if (delay > 0)
+  if (delay >= 0)
     {
       ret = wd_start(&timer->pt_wdog, delay, timer_timeout, (wdparm_t)timer);
       if (ret < 0)