time: Typedef time_t to int64_t if CONFIG_SYSTEM_TIME64 is defined

to handle 2038 problem correctly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-09-16 13:27:22 +08:00 committed by Petro Karashchenko
parent 1e6a8f56d3
commit 942513cd37
2 changed files with 6 additions and 1 deletions

View File

@ -48,6 +48,7 @@
#include <nuttx/config.h>
#include <debug.h>
#include <inttypes.h>
#include <stdint.h>
#include <stdbool.h>
#include <time.h>
@ -437,7 +438,7 @@ int up_alarm_start(const struct timespec *ts)
up_tmr_sync_down();
tmrinfo("%d.%09ld\n", ts->tv_sec, ts->tv_nsec);
tmrinfo("%" PRIdMAX ".%09ld\n", (uintmax_t)ts->tv_sec, ts->tv_nsec);
tmrinfo("start\n");
return OK;

View File

@ -98,7 +98,11 @@
/* Scalar types */
#ifdef CONFIG_SYSTEM_TIME64
typedef int64_t time_t; /* Holds time in seconds */
#else
typedef uint32_t time_t; /* Holds time in seconds */
#endif
typedef uint8_t clockid_t; /* Identifies one time base source */
typedef FAR void *timer_t; /* Represents one POSIX timer */