!apps: drop CONFIG_SYSTEM_TIME64 conditionals

NuttX always uses a 64-bit system clock now (time_t/clock_t are
always 64-bit). Remove the obsolete CONFIG_SYSTEM_TIME64 #ifdef
branches and Kconfig dependency.

  - examples/dronecan: drop SYSTEM_TIME64 dependency
  - examples/netlink_route: always use PRIx64
  - netutils/netinit: always use the 1-hour LONG_TIME_SEC
  - netutils/ptpd: always pack the 48-bit seconds field and apply
    the 64-bit overflow guard in timespec_delta_ns()
  - testing/ostest/semtimed: always validate tv_sec >= 0

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2026-05-03 15:54:26 +08:00 committed by Xiang Xiao
parent ed746548ca
commit 72837c8d26
5 changed files with 2 additions and 21 deletions

View file

@ -6,7 +6,7 @@
config EXAMPLES_DRONECAN
tristate "DroneCAN example"
default n
depends on CANUTILS_LIBDRONECAN && SYSTEM_TIME64
depends on CANUTILS_LIBDRONECAN
---help---
Enable the LIBDRONECAN example

View file

@ -168,11 +168,7 @@ static void dump_neighbor(void)
printf(" ");
}
#ifdef CONFIG_SYSTEM_TIME64
printf("Time 0x%" PRIx64 "\n", nb->ne_time);
#else
printf("Time 0x%" PRIx32 "\n", nb->ne_time);
#endif
}
free(nbtab);

View file

@ -204,11 +204,7 @@
* signal indicating a change in network status.
*/
#ifdef CONFIG_SYSTEM_TIME64
# define LONG_TIME_SEC (60*60) /* One hour in seconds */
#else
# define LONG_TIME_SEC (5*60) /* Five minutes in seconds */
#endif
#define LONG_TIME_SEC (60*60) /* One hour in seconds */
#define SHORT_TIME_SEC (2) /* 2 seconds */

View file

@ -184,13 +184,8 @@ static void timespec_to_ptp_format(FAR const struct timespec *ts,
* both fields big-endian.
*/
#ifdef CONFIG_SYSTEM_TIME64
timestamp[0] = (uint8_t)(ts->tv_sec >> 40);
timestamp[1] = (uint8_t)(ts->tv_sec >> 32);
#else
timestamp[0] = 0;
timestamp[1] = 0;
#endif
timestamp[2] = (uint8_t)(ts->tv_sec >> 24);
timestamp[3] = (uint8_t)(ts->tv_sec >> 16);
timestamp[4] = (uint8_t)(ts->tv_sec >> 8);
@ -320,7 +315,6 @@ static int64_t timespec_delta_ns(FAR const struct timespec *ts1,
delta_s = ts1->tv_sec - ts2->tv_sec;
#ifdef CONFIG_SYSTEM_TIME64
/* Conversion to nanoseconds could overflow if the system time is 64-bit */
if (delta_s >= INT64_MAX / NSEC_PER_SEC)
@ -331,7 +325,6 @@ static int64_t timespec_delta_ns(FAR const struct timespec *ts1,
{
return INT64_MIN;
}
#endif
return delta_s * NSEC_PER_SEC + (ts1->tv_nsec - ts2->tv_nsec);
}

View file

@ -79,11 +79,7 @@ static void ostest_gettime(struct timespec *tp)
printf("ostest_gettime: ERROR: clock_gettime failed\n");
ASSERT(false);
}
#ifdef CONFIG_SYSTEM_TIME64
else if (tp->tv_sec < 0 || tp->tv_nsec < 0 ||
#else
else if (tp->tv_nsec < 0 ||
#endif
tp->tv_nsec >= 1000 * 1000 * 1000)
{
printf("ostest_gettime: ERROR: clock_gettime returned bogus time\n");