This is an automated email from the ASF dual-hosted git repository. pkarashchenko pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push: new 942513cd37 time: Typedef time_t to int64_t if CONFIG_SYSTEM_TIME64 is defined 942513cd37 is described below commit 942513cd375a032c4ea0c23c892e6c8397d2084c Author: Xiang Xiao <xiaoxi...@xiaomi.com> AuthorDate: Fri Sep 16 13:27:22 2022 +0800 time: Typedef time_t to int64_t if CONFIG_SYSTEM_TIME64 is defined to handle 2038 problem correctly Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com> --- arch/x86_64/src/intel64/intel64_tickless.c | 3 ++- include/time.h | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/x86_64/src/intel64/intel64_tickless.c b/arch/x86_64/src/intel64/intel64_tickless.c index 573a93db33..613f5a7c3e 100644 --- a/arch/x86_64/src/intel64/intel64_tickless.c +++ b/arch/x86_64/src/intel64/intel64_tickless.c @@ -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; diff --git a/include/time.h b/include/time.h index 2b0a657cd1..7c18678ee7 100644 --- a/include/time.h +++ b/include/time.h @@ -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 */