diff --git a/sched/clock/clock_settime.c b/sched/clock/clock_settime.c index 4bfbd3345a..6eb8233a8a 100644 --- a/sched/clock/clock_settime.c +++ b/sched/clock/clock_settime.c @@ -64,7 +64,8 @@ int clock_settime(clockid_t clock_id, FAR const struct timespec *tp) * time clock. */ - if (clock_id == CLOCK_REALTIME) + if (clock_id == CLOCK_REALTIME && + tp->tv_nsec >= 0 && tp->tv_nsec < 1000000000) { #ifndef CONFIG_CLOCK_TIMEKEEPING /* Interrupts are disabled here so that the in-memory time