diff --git a/include/time.h b/include/time.h index ae810ee8413..d8c08d17951 100644 --- a/include/time.h +++ b/include/time.h @@ -93,7 +93,7 @@ /* Monotonic system-wide clock that includes time spent in suspension. */ #ifdef CONFIG_CLOCK_MONOTONIC -# define CLOCK_BOOTTIME CLOCK_MONOTONIC +# define CLOCK_BOOTTIME 2 #endif /* This is a flag that may be passed to the timer_settime() and diff --git a/sched/clock/clock_getres.c b/sched/clock/clock_getres.c index 8e80a83d13e..18b18a0cf26 100644 --- a/sched/clock/clock_getres.c +++ b/sched/clock/clock_getres.c @@ -74,6 +74,7 @@ int clock_getres(clockid_t clock_id, struct timespec *res) #ifdef CONFIG_CLOCK_MONOTONIC case CLOCK_MONOTONIC: + case CLOCK_BOOTTIME: #endif case CLOCK_REALTIME: diff --git a/sched/clock/clock_gettime.c b/sched/clock/clock_gettime.c index 6c3c35cef92..d35086207c2 100644 --- a/sched/clock/clock_gettime.c +++ b/sched/clock/clock_gettime.c @@ -88,7 +88,7 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp) * is invoked with a clock_id argument of CLOCK_MONOTONIC." */ - if (clock_id == CLOCK_MONOTONIC) + if (clock_id == CLOCK_MONOTONIC || clock_id == CLOCK_BOOTTIME) { /* The the time elapsed since the timer was initialized at power on * reset. diff --git a/sched/timer/timer_create.c b/sched/timer/timer_create.c index 9e4762294c8..85449faa9ad 100644 --- a/sched/timer/timer_create.c +++ b/sched/timer/timer_create.c @@ -161,6 +161,7 @@ int timer_create(clockid_t clockid, FAR struct sigevent *evp, if (timerid == NULL || (clockid != CLOCK_REALTIME #ifdef CONFIG_CLOCK_MONOTONIC && clockid != CLOCK_MONOTONIC + && clockid != CLOCK_BOOTTIME #endif /* CONFIG_CLOCK_MONOTONIC */ )) {