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/nuttx.git
commit bf870e51ba0fc9ec3cbb00674b7d695190914dd3 Author: Jukka Laitinen <jukka.laiti...@tii.ae> AuthorDate: Mon May 12 13:00:39 2025 +0300 arch/sim/sim_oneshot: Calculate next oneshot time in ticks instead of timespec This removes drift in tick start times, when the base time is always rounded to tick boundary. Signed-off-by: Jukka Laitinen <jukka.laiti...@tii.ae> --- arch/sim/src/sim/sim_oneshot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/sim/src/sim/sim_oneshot.c b/arch/sim/src/sim/sim_oneshot.c index 6148cdea6e..70139543a0 100644 --- a/arch/sim/src/sim/sim_oneshot.c +++ b/arch/sim/src/sim/sim_oneshot.c @@ -309,15 +309,15 @@ static int sim_start(struct oneshot_lowerhalf_s *lower, { struct sim_oneshot_lowerhalf_s *priv = (struct sim_oneshot_lowerhalf_s *)lower; - struct timespec current; irqstate_t flags; DEBUGASSERT(priv != NULL && callback != NULL && ts != NULL); flags = enter_critical_section(); - sim_timer_current(¤t); - clock_timespec_add(¤t, ts, &priv->alarm); + clock_ticks2time(&priv->alarm, + host_gettime(false) / NSEC_PER_TICK + + clock_time2ticks(ts)); priv->callback = callback; priv->arg = arg;