jlaitine commented on code in PR #15929: URL: https://github.com/apache/nuttx/pull/15929#discussion_r1982007886
########## arch/risc-v/src/common/riscv_mtimer.c: ########## @@ -310,18 +309,15 @@ static int riscv_mtimer_cancel(struct oneshot_lowerhalf_s *lower, ****************************************************************************/ static int riscv_mtimer_current(struct oneshot_lowerhalf_s *lower, - struct timespec *ts) + clock_t *ticks) { struct riscv_mtimer_lowerhalf_s *priv = (struct riscv_mtimer_lowerhalf_s *)lower; uint64_t mtime = riscv_mtimer_get_mtime(priv); - uint64_t left; - ts->tv_sec = mtime / priv->freq; - left = mtime - ts->tv_sec * priv->freq; - ts->tv_nsec = NSEC_PER_SEC * left / priv->freq; + *ticks = mtime / priv->cycle_per_tick; Review Comment: This works, if you accept that tick time is not even multiple of underlying hw timer. Theoretically wrong of course, since it wouldn't overflow correctly, but that is semantics, it is probably not relevant to count ticks past the end of the universe... -- 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