ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
ptp.h File Reference

PTP / IEEE 1588-2008 (PTPv2) message codec + slave clock math (PC_ENABLE_PTP). More...

#include "protocore_config.h"

Go to the source code of this file.

Detailed Description

PTP / IEEE 1588-2008 (PTPv2) message codec + slave clock math (PC_ENABLE_PTP).

The Precision Time Protocol synchronizes clocks across a LAN to sub-microsecond accuracy by exchanging timestamped messages. This codec builds and parses the PTPv2 wire format - the 34-octet common header, the 10-octet (48-bit seconds + 32-bit nanoseconds) timestamp, the E2E Sync / Delay_Req / Follow_Up / Delay_Resp / Announce messages, and the P2P peer-delay messages (Pdelay_Req / Pdelay_Resp / Pdelay_Resp_Follow_Up, IEEE 1588-2008 ยง11.4) - and computes an ordinary-clock slave's offset-from-master and mean-path-delay from the four transfer timestamps (t1..t4), plus the P2P meanLinkDelay. All multi-octet fields are big-endian (network order), per IEEE 1588-2008 clause 13. Pure and host-tested; the UDP transport (event port 319, general port 320, multicast 224.0.1.129) and the local timestamping are the application's - see the Ptp example for the ordinary-clock slave that drives this codec.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file ptp.h.