anchao commented on code in PR #16343: URL: https://github.com/apache/nuttx/pull/16343#discussion_r2081507422
########## sched/timer/timer_settime.c: ########## @@ -331,6 +331,16 @@ int timer_settime(timer_t timerid, int flags, timer->pt_expected = clock_systime_ticks() + delay; } + /* This is to prevent the insufficient sleep time if we are + * currently near the boundary to the next tick. + * | current_tick | current_tick + 1 | current_tick + 2 | .... | + * | ^ Here we get the current tick + * In this case we delay 1 tick, timer will be triggered at + * current_tick + 1, which is not enough for at least 1 tick. + */ + + timer->pt_expected += 1; Review Comment: LGTM, how about move all + 1 tick logic into a macro? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org