This is an automated email from the ASF dual-hosted git repository.
lupyuen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new ae1731210df sched/clock: fix CLOCK_BOOTTIME and CLOCK_MONOTONIC
handling
ae1731210df is described below
commit ae1731210dfbe70664270127fb5a1ffe6cc54e7c
Author: wangchengdong <[email protected]>
AuthorDate: Wed Feb 25 09:37:13 2026 +0800
sched/clock: fix CLOCK_BOOTTIME and CLOCK_MONOTONIC handling
The current implementation retrieves time from the same source for both
CLOCK_BOOTTIME and CLOCK_MONOTONIC, which is incorrect. CLOCK_BOOTTIME
includes time spent in system suspend, whereas CLOCK_MONOTONIC does not.
This patch fixes the incorrect clock source handling and ensures the
two clocks are distinguished properly.
Signed-off-by: Chengdong Wang <[email protected]>
---
sched/clock/clock_gettime.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sched/clock/clock_gettime.c b/sched/clock/clock_gettime.c
index 198b88c59ba..a154a52c835 100644
--- a/sched/clock/clock_gettime.c
+++ b/sched/clock/clock_gettime.c
@@ -97,7 +97,7 @@ int nxclock_gettime(clockid_t clock_id, FAR struct timespec
*tp)
return -EINVAL;
}
- if (clock_id == CLOCK_MONOTONIC || clock_id == CLOCK_BOOTTIME)
+ if (clock_id == CLOCK_MONOTONIC)
{
/* The the time elapsed since the timer was initialized at power on
* reset, excluding the time that the system is suspended.