xiaoxiang781216 opened a new pull request, #3476:
URL: https://github.com/apache/nuttx-apps/pull/3476
## Summary
Follow-up cleanup to the recent `time_t`/`clock_t` 64-bit consolidation
(commits "drop CONFIG_SYSTEM_TIME64 conditionals" and
"replace sclock_t with clock_t and drop redundant time_t/off_t casts").
NuttX's `time_t` is now unconditionally a signed 64-bit type, so the
explicit `(uint64_t)`, `(int64_t)`, and `(int)` casts that used to be
sprinkled around `tv_sec` / `tv_nsec` arithmetic — to avoid 32-bit
multiplication/subtraction overflow back when `time_t` could be 32-bit —
are no longer needed. This PR drops those now-redundant casts to keep
the timekeeping helpers readable and consistent with the rest of the
recently-cleaned-up code.
Files touched (one-liners each):
- `benchmarks/cyclictest/cyclictest.c` — `timediff_us()`
- `benchmarks/sd_bench/sd_bench_main.c` — `get_time_delta_us()`
- `examples/oneshot/oneshot_main.c` — `maxus` computation
- `examples/watchdog/watchdog_main.c` — `current_time_ms` (×2)
- `industry/nxmodbus/nxmb_internal.h` — `nxmb_util_clock_ms()`
- `netutils/ntpclient/ntpclient.c` — `timespec2ntp()`
- `netutils/ptpd/ptpd.c` — `ptp_adjtime()`
- `system/dd/dd_main.c` — `elapsed` accounting
- `testing/drivers/drivertest/drivertest_posix_timer.c` — `get_timestamp()`
- `testing/drivers/sd_stress/sd_stress_main.c` — `get_time_delta()`
- `testing/sched/getprime/getprime_main.c` — `elapsed` accounting
- `testing/sched/pthread_mutex_perf/pthread_mutex_perf.c` — `timespec_avg()`
## Impact
- Users: none — purely a readability/cleanup change.
- Build process: none — same generated code on every supported
compiler (the dropped casts were already no-ops once `time_t`
became 64-bit).
- Hardware: none.
- Documentation: none.
- Security: none.
- Compatibility: none — `time_t`/`tv_sec`/`tv_nsec` widths are
unchanged; this PR only removes pleonastic casts.
No behavioural change is intended.
## Testing
Build-tested host-side together with the corresponding `nuttx`-side
`time_t`/`clock_t` cleanups; the touched helpers all expand to the
same arithmetic as before because the dropped casts no longer
widen anything.
- Host: Ubuntu 22.04 x86_64, GCC 11
- Targets exercised by the changed sources at build time:
- `sim:nsh` (covers `examples/watchdog`, `examples/oneshot`,
`system/dd`, `testing/sched/*`, `benchmarks/cyclictest`,
`benchmarks/sd_bench`, `testing/drivers/*`)
- `sim:netnsh` (covers `netutils/ntpclient`, `netutils/ptpd`,
`industry/nxmodbus`)
No new compiler warnings; no functional difference observed in the
benchmark / test outputs before and after the change.
--
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]