mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 21:34:07 +08:00
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:
committed by
Lup Yuen Lee
parent
303760b937
commit
ae1731210d
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user