How nwtime/linuxptp works
LinuxPTP implements IEEE 1588 synchronization on Linux. Its central workflow is PTP messages exchanged over a configured network transport, processed by ports and clock selection, then used to discipline a clock through a servo and Linux clock/PHC interfaces. Separate programs support clock-to-clock synchronization, PPS-based synchronization, management, and monitoring. Relationships below rely on README capability statements and the supplied source index; unsampled implementation details are not treated as verified calls.
Main entry points: clock.c PTP clock · port.c PTP ports · transport.c Transport layer · ptp4l.c PTP daemon
Components 25
PTP synchronization
- PTP daemon
ptp4l.c - Configuration
config.c - PTP clock
clock.c - PTP ports
port.c - Best master selection
bmc.c - Clock servo
servo.c
Transport and timing I/O
- Transport layer
transport.c - Raw Ethernet
raw.c - UDP transport
udp.c - UDP IPv6
udp6.c - Timestamp sockets
sk.c - PHC access
phc.c - Clock adjustment
clockadj.c
Management and monitoring
- Management client
pmc.c - Management protocol
pmc_common.c - NetSync monitor
nsm.c
Synchronization tools
- Clock synchronization tool
phc2sys.c - PPS synchronization tool
ts2phc.c - Time master
timemaster.c
Protocol and security
- PTP messages
msg.c - TLV processing
tlv.c - Authentication
sad.c
Other components
- Operator
- Linux clocks and network
- PTP management peer
Connections 25
- Operator → PTP daemon: configures
- PTP daemon → Configuration: reads settings
- PTP daemon → PTP clock: starts clock
- PTP clock → PTP ports: opens ports
clock.c - PTP clock → PHC access: uses PHC
clock.c - PTP clock → Clock servo: uses servo
clock.c - PTP ports → PTP clock: updates state
port.c - PTP ports → PTP messages: processes messages
port.c - PTP ports → TLV processing: handles TLVs
port.c - PTP clock → Best master selection: selects master
clock.c - Transport layer → Raw Ethernet: supports Ethernet
- Transport layer → UDP transport: supports UDP
- Transport layer → UDP IPv6: supports IPv6
- Raw Ethernet → Timestamp sockets: uses sockets
raw.c - Timestamp sockets → Linux clocks and network: timestamps packets
- PHC access → Linux clocks and network: accesses PHC
- Clock adjustment → Linux clocks and network: adjusts clock
- PTP messages → TLV processing: parses TLVs
msg.c - Authentication → PTP messages: authenticates
sad.c - Management client → Management protocol: uses protocol
pmc.c - PTP management peer → Management client: exchanges management
- NetSync monitor → Linux clocks and network: monitors network
- Clock synchronization tool → Linux clocks and network: synchronizes clocks
- PPS synchronization tool → Linux clocks and network: uses PPS timing
- Time master → Linux clocks and network: coordinates clocks