diff --git a/include/time.h b/include/time.h index 5952f1b69da..bf5d0c1be7a 100644 --- a/include/time.h +++ b/include/time.h @@ -102,7 +102,7 @@ /* Scalar types */ -typedef uint32_t time_t; /* Holds time in seconds */ +typedef long time_t; /* Holds time in seconds */ typedef uint8_t clockid_t; /* Identifies one time base source */ typedef FAR void *timer_t; /* Represents one POSIX timer */ diff --git a/sched/clock/clock_settime.c b/sched/clock/clock_settime.c index 6eb8233a8ad..b0f8de9a1b5 100644 --- a/sched/clock/clock_settime.c +++ b/sched/clock/clock_settime.c @@ -65,7 +65,8 @@ int clock_settime(clockid_t clock_id, FAR const struct timespec *tp) */ if (clock_id == CLOCK_REALTIME && - tp->tv_nsec >= 0 && tp->tv_nsec < 1000000000) + tp->tv_nsec >= 0 && tp->tv_nsec < 1000000000 && + tp->tv_sec >= 0) { #ifndef CONFIG_CLOCK_TIMEKEEPING /* Interrupts are disabled here so that the in-memory time