diff --git a/include/sys/types.h b/include/sys/types.h index 23e8fbbbf4e..f1f655de7ed 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -230,10 +230,8 @@ typedef uint16_t sa_family_t; #ifdef CONFIG_SYSTEM_TIME64 typedef uint64_t clock_t; -typedef int64_t time_t; #else typedef uint32_t clock_t; -typedef int32_t time_t; #endif /* The type useconds_t shall be an unsigned integer type capable of storing diff --git a/include/time.h b/include/time.h index 7f6b3bd8539..5952f1b69da 100644 --- a/include/time.h +++ b/include/time.h @@ -102,6 +102,7 @@ /* Scalar types */ +typedef uint32_t 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/libs/libc/time/lib_localtime.c b/libs/libc/time/lib_localtime.c index 5a110f0377f..66e90c7ab93 100644 --- a/libs/libc/time/lib_localtime.c +++ b/libs/libc/time/lib_localtime.c @@ -2265,7 +2265,7 @@ static time_t time2sub(FAR struct tm *tmp, else { lo = 1; - for (i = 1; i < (int)TYPE_BIT(time_t) - 1; ++i) + for (i = 0; i < (int)TYPE_BIT(time_t) - 1; ++i) { lo *= 2; } diff --git a/sched/clock/clock_settime.c b/sched/clock/clock_settime.c index b0f8de9a1b5..6eb8233a8ad 100644 --- a/sched/clock/clock_settime.c +++ b/sched/clock/clock_settime.c @@ -65,8 +65,7 @@ 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_sec >= 0) + tp->tv_nsec >= 0 && tp->tv_nsec < 1000000000) { #ifndef CONFIG_CLOCK_TIMEKEEPING /* Interrupts are disabled here so that the in-memory time