Hello,
I have problems with the following commit, which is part of PR #17199 commit c7b6442974545b92476615ef048633609d828e5b Author: wangchengdong <[email protected]> Date: Mon Oct 13 20:57:43 2025 +0800 sched/clock: Improve CLOCK_MONOTONIC nxclock_gettime() Improve nxclock_gettime(), to get the system time excluding the time that the system is suspended, when the clockid is CLOCK_MONOTONIC Signed-off-by: Chengdong Wang [email protected] This commit changes the behaviour of CLOCK_MONOTONIC. It is running slower than CLOCK_BOOTTIME now. I called sem_clockwait() with CLOCK_MONOTONIC, but the "if" in line 143 in nuttx/sched/semaphore/sem_clockwait.c handles on two cases. I used CLOCK_MONOTONIC to calculate the value "abstime", but wd_start_abstime() uses CLOCK_BOOTTIME now. When the system in running for some time this leads to an immediate timeout, because two different clocks are compared. int nxsem_clockwait(FAR sem_t *sem, clockid_t clockid, FAR const struct timespec *abstime) { ... if (clockid == CLOCK_REALTIME) { wd_start_realtime(&rtcb->waitdog, abstime, nxsem_timeout, (uintptr_t)rtcb); } else { wd_start_abstime(&rtcb->waitdog, abstime, nxsem_timeout, (uintptr_t)rtcb); } ... For my understanding the change of CLOCK_MONOTONIC is not correct. According to the POSIX definition https://pubs.opengroup.org/onlinepubs/9799919799/ it must be a "system-wide monotonic clock", CLOCK_BOOTTIME is not defined here. On the other hand, if such a low level change is made, all usages should be reviewed. There a lot of places where CLOCK_MONOTONIC is used in the nuttx source code. And there are places like in nxsem_clockwait() where the change leads to an error even though CLOCK_MONOTONIC is not used in the code. What do you think? BR, Mathias
