There are numerous protocols for synchronising clocks within a network infrastructure. The most known are NTP (network Time Protocol) and SNTP (Simple NTP), but when the utmost precision is required, the PTP (Precision Time Protocol) is chosen.
PTP was introduced in 2002 (in the IEEE 1588 standard) and has undergone numerous evolutions since (the latest version of the standard dates from 2019).
One of the most important algorithmic components of PTP is the BMCA (Best Master Clock Algorithm). BMCA allows you to establish a hierarchy of clocks (also called timing hierarchy or timing tree) and selects, within this hierarchy, the best master clock amongst all other clocks in the network. This master clock will then provide the time reference for all devices in the network.