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 <wangchengdong@lixiang.com>
This commit is contained in:
wangchengdong
2026-02-25 09:37:13 +08:00
committed by Lup Yuen Lee
parent 303760b937
commit ae1731210d
+1 -1
View File
@@ -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.