!sched/clock: remove CONFIG_SYSTEM_TIME64 and always use 64-bit time

The 32-bit system clock has a limited range (~497 days) and the
configuration knob is no longer worth the complexity given that
practically every modern target already enables it.  Make 64-bit
time_t/clock_t/sclock_t/nuttx_time_t the only supported flavor.

Specifically:
  - Drop the SYSTEM_TIME64 Kconfig option and its dependent
    PERF_OVERFLOW_CORRECTION/HRTIMER guards in sched/Kconfig.
  - Remove every #ifdef CONFIG_SYSTEM_TIME64 branch in headers
    (include/{sys/types.h,limits.h,inttypes.h,nuttx/clock.h,
    nuttx/fs/hostfs.h}) and core code paths
    (sched/clock/clock.h, drivers/power/pm/pm_procfs.c,
    drivers/rpmsg/rpmsg_ping.c, fs/procfs/fs_procfsuptime.c,
    libs/libc/wqueue/work_usrthread.c,
    arch/avr/src/avrdx/avrdx_timerisr_tickless_alarm.c).
  - Strip CONFIG_SYSTEM_TIME64=y from every board defconfig.
  - Update Documentation/guides/rust.rst accordingly.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2026-05-19 16:21:28 +08:00
committed by Xiang Xiao
parent 1b3af76bf3
commit c6654b1106
187 changed files with 147 additions and 338 deletions
-30
View File
@@ -338,36 +338,6 @@
#define SCNxOFF SCNx32
#endif
/* time_t */
#ifdef CONFIG_SYSTEM_TIME64
#define PRIdTM PRId64
#define PRIiTM PRIi64
#define PRIoTM PRIo64
#define PRIuTM PRIu64
#define PRIxTM PRIx64
#define PRIXTM PRIX64
#define SCNdTM SCNd64
#define SCNiTM SCNi64
#define SCNoTM SCNo64
#define SCNuTM SCNu64
#define SCNxTM SCNx64
#else
#define PRIdTM PRId32
#define PRIiTM PRIi32
#define PRIoTM PRIo32
#define PRIuTM PRIu32
#define PRIxTM PRIx32
#define PRIXTM PRIX32
#define SCNdTM SCNd32
#define SCNiTM SCNi32
#define SCNoTM SCNo32
#define SCNuTM SCNu32
#define SCNxTM SCNx32
#endif
/****************************************************************************
* Type Definitions
****************************************************************************/
+1 -5
View File
@@ -236,11 +236,7 @@
#define TIMER_MAX _POSIX_TIMER_MAX
#define CLOCKRES_MIN _POSIX_CLOCKRES_MIN
#ifdef CONFIG_SYSTEM_TIME64
# define CLOCK_MAX UINT64_MAX
#else
# define CLOCK_MAX UINT32_MAX
#endif
#define CLOCK_MAX UINT64_MAX
/* Other invariant values */
+1 -6
View File
@@ -225,8 +225,7 @@
#define NSEC2MSEC(nsec) div_const(nsec, (uint32_t)NSEC_PER_MSEC)
#if defined(CONFIG_DEBUG_SCHED) && defined(CONFIG_SYSTEM_TIME64) && \
!defined(CONFIG_SCHED_TICKLESS)
#if defined(CONFIG_DEBUG_SCHED) && !defined(CONFIG_SCHED_TICKLESS)
/* Initial system timer ticks value close to maximum 32-bit value, to test
* 64-bit system-timer after going over 32-bit value. This is to make errors
* of casting 64-bit system-timer to 32-bit variables more visible.
@@ -307,11 +306,7 @@ struct cpuload_s
* should be used only within the OS proper and not by portable applications.
*/
#ifdef CONFIG_SYSTEM_TIME64
typedef int64_t sclock_t;
#else
typedef int32_t sclock_t;
#endif
/****************************************************************************
* Public Data
-4
View File
@@ -136,11 +136,7 @@ typedef int nuttx_fsid_t[2];
/* These must match the definition in include/time.h */
# ifdef CONFIG_SYSTEM_TIME64
typedef uint64_t nuttx_time_t;
# else
typedef uint32_t nuttx_time_t;
# endif
struct nuttx_timespec
{
-5
View File
@@ -251,13 +251,8 @@ typedef uint16_t sa_family_t;
* unsigned type is used to support the full range of the internal clock.
*/
#ifdef CONFIG_SYSTEM_TIME64
typedef uint64_t clock_t;
typedef uint64_t time_t; /* Holds time in seconds */
#else
typedef uint32_t clock_t;
typedef uint32_t time_t; /* Holds time in seconds */
#endif
typedef int clockid_t; /* Identifies one time base source */
typedef FAR void *timer_t; /* Represents one POSIX timer */