xiaoxiang781216 opened a new pull request, #18842:
URL: https://github.com/apache/nuttx/pull/18842
## Summary
POSIX leaves the signedness of `time_t` unspecified, but all mainstream
implementations (glibc / musl, the BSDs, macOS, Windows `_time64_t`,
RTEMS, Zephyr's POSIX layer, …) expose it as a **signed** 64-bit
integer. NuttX has historically used `uint64_t` only because the
`CONFIG_SYSTEM_TIME64` knob always selected an unsigned type when 64-bit
time was enabled. With that knob removed, switch `time_t` to `int64_t`
so that:
- `(time_t)-1` sentinels and arithmetic with negative deltas behave the
same way as on every other POSIX system;
- third-party code and host-side headers that already assume signed
`time_t` (libc++/STL, OpenSSL, lwIP, etc.) drop in cleanly;
- comparisons such as `tv_sec < 0` (used in the libc, the testing/
ostest semtimed test, ptpd, …) keep their POSIX semantics.
`clock_t` stays `uint64_t` (the comment in `sys/types.h` already
explains why — it tracks free-running ticks and benefits from the full
unsigned range).
## Changes
- `include/sys/types.h`: `typedef int64_t time_t`.
- `include/nuttx/fs/hostfs.h`: `nuttx_time_t` follows suit
(`int64_t`).
- Format-string fixups for the now-signed `tv_sec` / `time_t`:
- `drivers/rpmsg/rpmsg_ping.c` — `PRIu64` → `PRId64`
- `arch/xtensa/src/esp32{,s2,s3}/esp32*_oneshot_lowerhalf.c` —
pre-existing `PRIu32` print was wrong even before; switch to
`PRId64` with an explicit cast.
## Testing
- `tools/checkpatch.sh -f` clean on all changed files.
## Dependency
Stacked on top of #18840 (`CONFIG_SYSTEM_TIME64` removal); needs that
PR to land first.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]