How PTP works
In a computer network, multiple nodes are interconnected by edges (connections) between these devices. By employing the Best Master Clock Algorithm (BMCA), a PTP network determines the hierarchy of clocks in the network. It removes redundant connections and organizes the entire network into a hierarchical structure resembling "a tree." This simplifies time synchronization, as circular configurations are avoided. Within such a network, a single device is designated as the grandmaster (GM), responsible for controlling precise time. Other devices receive time messages from the GM. Through the exchange of several messages among the clocks in all devices, the entire network can achieve clock accuracy in the sub-microsecond range.- BMC Algorithm: using some mechanisms to determine which clock is more suitable to be a master. You can see more details here