The network protocols NTP (Network Time Protocol) and PTP (Precision Time Protocol) are used to precisely synchronize devices and systems in a network. Which protocol is suitable for which application?
The function of NTP briefly summarized
NTP uses a hierarchy of time servers to transmit the exact time of a primary reference source to the connected systems in network packets.
Primary time reference - usually an atomic clock
Stratum 1 servers - directly connected to the primary time reference
Stratum 2 servers - synchronize their time with Stratum 1 servers. They can either be directly connected to Stratum 1 servers or access them via the Internet. Stratum 2 servers can then share their time with Stratum 3 servers.
More Stratum Servers - This process continues, with the number of strata increasing the further away the servers are from the primary time reference. Accuracy usually decreases the higher the stratum.
A client that needs time sends a request to an NTP server. The server responds with the current time and information about its accuracy and reliability. The client then adjusts its internal time accordingly, taking into account the information from the server.
The function of NTP briefly summarized
PTP also sends time packets in a network. However, PTP is designed for a local network. This makes it possible to calculate the transit times of the data packets.
Master-slave relationship: In a PTP network, there is usually one grandmaster and several slaves. The master is a high-precision time source, while the slaves synchronize their time with the master.
Sync and follow-up messages: The master periodically sends out sync messages containing the master's timestamp and network latency information. The slaves receive these messages and use them to adjust their time. The master then sends follow-up messages to ensure that the slaves have made the adjustments correctly.
Determining the latency: To synchronize the time correctly, the slaves measure the time it takes to receive the sync messages from the master. This latency is then taken into account when adjusting the slave time to improve accuracy.
Two-step synchronization: PTP uses two-step synchronization, where the slave first receives the sync message and then uses the follow-up message to adjust the time. This allows accuracies in the sub-microsecond range to be achieved.
Redundancy and hierarchy: PTP also supports redundancy and hierarchy, similar to NTP. This makes it possible to have multiple master and slave devices in a network and create a hierarchy of time sources to improve reliability and accuracy.
Continuous Synchronization: PTP devices continuously monitor their time and adjust it as needed to correct drift errors and ensure that their internal time is accurate.
The accuracy of NTP and PTP in comparison
Public NTP server
Accuracy in the range of a few milliseconds to seconds, depending on the network connectivity and the utilization of the server.
Internal NTP Server
Typically offers higher accuracy in the millisecond to microsecond range as it operates on a local network with less latency.
PTP-Server
Provides the highest accuracy in the sub-microsecond to microsecond range, ideal for applications requiring extremely precise time synchronization.
Applications for time servers
Public NTP server
The accuracy of a public NTP server accessible via the Internet is sufficient to provide private computers and networks with accurate time stamps.
For all applications that require reliable time synchronization better than seconds, public time servers are not sufficient.
Internal NTP Server
Corporate networks that require fail-safe time synchronization in the millisecond range for their data servers are well advised to use their own NTP server.
An internal NTP server can be synchronized via GNSS and should have its own time source with good long-term stability.
PTP-Server
Industrial control systems, telecommunication networks, financial service providers or applications in medicine or aerospace require the accuracy of a PTP server.
These applications require an accuracy of at least microseconds to ensure cooperation and the rapid sequence of processes.