nuttx-apps/netutils/ptpd
Xiang Xiao 832e61c1c4 netutils/ptpd: Add the missing comparison in is_better_clock
The original implementation only checked if each field was less than,
but didn't check for greater than before proceeding to the next field.
This caused incorrect clock selection behavior in the PTP Best Master
Clock Algorithm (BMCA).

The fix expands each comparison to explicitly check both < and >
conditions, returning the appropriate result immediately. This ensures
proper precedence evaluation according to IEEE 1588 specification:
- gm_priority1
- gm_quality (class, accuracy, variance)
- gm_priority2
- gm_identity

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-12-30 08:51:51 -03:00
..
CMakeLists.txt netutils/ptpd: add CMakelist for ptpd 2025-12-30 08:51:51 -03:00
Kconfig netutils/ptpd: using DEBUG_PTP_ERR/WARN/INFO to replace NETUTILS_PTPD_DEBUG 2025-12-30 08:51:51 -03:00
Make.defs netutils: migrate the license to ASF 2024-12-21 13:53:10 +08:00
Makefile netutils: migrate the license to ASF 2024-12-21 13:53:10 +08:00
ptpd.c netutils/ptpd: Add the missing comparison in is_better_clock 2025-12-30 08:51:51 -03:00
ptpv2.h netutils/ptpd: byte align for ptp structure 2025-12-30 08:51:51 -03:00