mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
!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:
parent
ed746548ca
commit
72837c8d26
5 changed files with 2 additions and 21 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue