zhhyu7 opened a new pull request, #4202:
URL: https://github.com/apache/nuttx-apps/pull/4202
## Summary
- Build without CONFIG_ENABLE_ALL_SIGNALS: the status/stop signal
handlers use sigaction() and siginfo_t, so compile them only with
CONFIG_ENABLE_ALL_SIGNALS (as netutils/dhcpc does); the in-memory IPC
still works.
- Step the local clock on the first sync sample. Before, a first offset
below CONFIG_NETUTILS_PTPD_SETTIME_THRESHOLD_MS was slewed, which can
take a long time after boot. The flag lives in struct ptp_state_s, so
a ptpd restarted after ptpd_stop() steps again.
- Compute interval_s * MSEC_PER_SEC and drift_ppb *
CONFIG_CLOCK_ADJTIME_PERIOD_MS in int64_t; both were long, which
overflows on 32-bit targets.
## Impact
- ptpd only. The first sync after start now steps the clock.
## Testing
Two sim:dynconns instances on the nuttx0 bridge with CONFIG_PTP_CLOCK,
CONFIG_CLOCK_ADJTIME, CONFIG_NET_IGMP and software timestamps (-S).
Instance A (apache/master) runs "ptpd -i eth0 -S" as master at
10.0.1.10; instance B runs "ptpd -i eth0 -S -s -r" as client at
10.0.1.11. "ptpd -t <pid>" on B after 25 s.
B = this branch:
```
nsh> ptpd -t 8
PTPD (PID 8) status:
- clock_source_valid: 0
- last_clock_update: 2026-11-30T03:48:31.347906175
- last_delta_ns: 60242
- last_adjtime_ns: 21266
- drift_ppb: -40182
- path_delay_ns: 0
- last_received_multicast: 0 s ago
- last_received_announce: 49 s ago
- last_received_sync: 0 s ago
```
B = apache/master (same master A):
```
nsh> ptpd -t 8
PTPD (PID 8) status:
- clock_source_valid: 0
- last_clock_update: 2026-11-30T03:49:47.622788665
- last_delta_ns: -8521514
- last_adjtime_ns: -8521514
- drift_ppb: 0
- path_delay_ns: 0
- last_received_multicast: 0 s ago
- last_received_announce: 49 s ago
- last_received_sync: 0 s ago
```
With the branch the client stepped the clock on the first sample and
then estimated a drift (offset 60 us, drift -40 ppm); master is still
slewing an 8.5 ms first offset with no drift estimate.
Build check with CONFIG_ENABLE_PARTIAL_SIGNALS=y: this branch builds;
apache/master fails to link with "undefined reference to `NXsigaction'"
from ptpd_start(). CONFIG_DISABLE_ALL_SIGNALS=y does not link on
apache/master even without ptpd (nx_poll/nxsig_waitmask_set), so it was
not used.
checkpatch.sh -c -u -m -g passes for every commit.
--
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]