mirror of
https://github.com/apache/nuttx.git
synced 2026-08-22 14:08:30 +00:00
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 wangchengdong@lixiang.com
This commit is contained in:
parent
1a22f4bf28
commit
c7b6442974
1 changed files with 10 additions and 2 deletions
|
|
@ -88,10 +88,18 @@ static clock_t clock_process_runtime(FAR struct tcb_s *tcb)
|
|||
|
||||
void nxclock_gettime(clockid_t clock_id, FAR struct timespec *tp)
|
||||
{
|
||||
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.
|
||||
* reset, excluding the time that the system is suspended.
|
||||
*/
|
||||
|
||||
clock_ticks2time(tp, clock_get_sched_ticks());
|
||||
}
|
||||
else if (clock_id == CLOCK_BOOTTIME)
|
||||
{
|
||||
/* The the time elapsed since the timer was initialized at power on
|
||||
* reset, including the time that the system is suspended..
|
||||
*/
|
||||
|
||||
clock_systime_timespec(tp);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue