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.
This commit is contained in:
larry 2022-07-16 08:46:05 +08:00 committed by Xiang Xiao
parent 19f269e54b
commit 2721e01fc2
1 changed files with 5 additions and 5 deletions

View File

@ -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)