- 1. Introduction
- 2. NTP – Network Time Protocol (RFC 1305, 5905)
- 2.1. Synchronization principle – NTP Unicast
- 2.2. Synchronization principle – NTP Multicast
- 2.3. Definition of Stratum in the NTP Time Synchronization
- 3. PTP – Precision Time Protocol (IEEE 1588)
- 3.1. Synchronization principle – PTP
- 3.1.1. Syntonization – Adjust the slaves frequency to the master
- 3.1.2. Synchronization – Adjust the slaves time to the master
- 3.2. Synchronization of a PTP client
- 3.3. Configuration possibilities
- 3.3.1. Delay measurement Mode – E2E or P2P
- 3.3.2. Multicast and Unicast configuration
- 3.3.3. Layer 2 and Layer 3
- 3.3.4. 1-Step and 2-Step configuration
- 3.3.5. Message intervals and timeouts
- 3.4. Profiles
- 4. Comparison – NTP vs. PTP
- 4.1. Network traffic
- 4.2. Number of clients
- 4.3. Which is the right protocol for your application?
- 5. How can Mobatime support?
Both, PTP and NTP provides time synchronization over a packet-based network. PTP defines synchronization messages used between a Master and Slave clock similar to the Server and Client mode used in the Network Time Protocol (NTP). Nevertheless, not both protocols are dedicated to the same applications. It depends on the system’s needs, which of the protocol is preferred.
This article explains the working principle of both protocols and shows their differences. The here provided description of both protocols enables the reader to understand the benefits of both protocols and helps him to choose the right solution for his needs.
2. NTP – Network Time Protocol (RFC 1305, 5905)
NTP is an old internet protocol, which is still widely used to distribute time. NTP provides a simple way to synchronize all device over a regular network and even over the public internet. To ensure a reliable time in a local network, the best solution is to place an NTP server, which is connected to a GNSS Antenna, into the network. Whereas time is needed for clocks, access control systems and other such systems, the accuracy of NTP is sufficient. The benefit of NTP is its robustness and its ability to run on standard IT equipment.
NTP uses the user datagram protocol UDP to transmit the requests and replies. NTP supports two different modes.
2.1. Synchronization principle – NTP Unicast
To synchronize its clock with a remote server, the NTP client must compute the round-trip delay time and the offset. The round-trip delay is computed as
t0 is the client’s timestamp of the request packet transmission,
t1 is the server’s timestamp of the request packet reception,
t2 is the server’s timestamp of the response packet transmission and
t3 is the client’s timestamp of the response packet reception.
t3 − t0 is the time elapsed on the client side between the emission of the request packet and the reception of the response packet and
t2 − t1 is the time the server waited before sending the answer.
The offset θ is given by
The NTP synchronization is correct when both the incoming and outgoing routes between the client and the server have symmetrical nominal delay.
2.2. Synchronization principle – NTP Multicast
Multicast is a type of broadcast, but only for a defined group of end devices. The end devices register their group membership with a dummy IP address via IGMP (Internet Group Management Protocol) on the switch or router. The switch / router registers to which port it has to send which multicast packets. This type of time synchronization only puts a minimal load on the network, as communication only takes place in one direction and only to the participants in the same multicast group.
- the clients join a group and “listen in“ on the group address
- the clients do not need an IP address
- the server sends data to the group address
- unidirectional communication
- the group address is an IP address in the range from 220.127.116.11 to 18.104.22.168
2.3. Definition of Stratum in the NTP time Synchronization
NTP uses a hierarchical system of levels of clock sources. Each level of this hierarchy is termed a stratum and is assigned a layer number starting with zero at the top. The stratum level defines its distance from the reference clock. It is important to note that the stratum is not an indication of quality or reliability. This definition of stratum is also different from the notion of clock strata used in telecommunication systems.
Yellow arrows indicate a direct connection; red arrows indicate a network connection.
GNSS clocks are usually considered as stratum 0 clock. That means a NTP-Server, synchronized by a GNSS time signal receiver, represents a stratum 1 clock.
3. PTP – Precision Time Protocol
Precision Time Protocol (PTP) is a protocol used to synchronize clocks throughout a packet-based network. It is used to provide a highly accurate and reliable time across local or wide area networks for various systems and applications. PTP is defined in the IEEE 1588 standard.
3.1. Synchronization principle – PTP
To adapt its time to the master’s time, the slave needs to correct to values. First the slave corrects its clock drift (Syntonization) and then adapts his time by determining the offset based on the duration of the transmission (Synchronization)
3.1.1. Syntonization – Adjust the slaves frequency to the master
Prior to the time synchronization, the slave uses the consecutive sync messages to syntonize itself to the master (align its frequency). The difference between two consecutive timestamps t1 is telling the slave the interval of sync messages from the master. With his own timestamps t2 he is now able to calculate and compensate his clock deviation. This procedure is repeated regularly to compensate frequency varies over time due to environmental conditions or other changes.
3.1.2. Synchronization – Adjust the slaves time to the master
To synchronize the time of a PTP slave the here shown process is used. The master starts it by sending a sync message (and follow up in two-step mode). Then the slave sends the delay request and gets the delay response back. With these messages, the slave collects the four timestamps t1 to t4, which enable him to calculate his offset and adapt his time to the one of the master. The key to the accuracy of PTP is the precision of those four timestamps, because of that hardware timestamping is required.
3.2. Synchronization of a PTP client
The standard does not define how the slave is correcting his internal clock. There are two options:
- Smooth transition: The slave accelerates or slows down its clock until it is aligned with the master time
- Immediate step: The slave sets the time to the master’s time (jump forwards or backwards).
It depends on the application, which behavior is used. If it is not allowed to have time jumps (e.g. for logging reasons), the smooth transition is required. On the other hand, if quick alignment is important, it is better to have a jump and then immediately the correct time.
3.3. Configuration possibilities
3.3.1. Delay measurement Mode – E2E or P2P
End to End (E2E):
This delay mechanism requires the Slave to measure the delay between itself and the Master (thus End-to-End). The Master and Slave send IEEE 1588 messages called DELAY REQUEST and DELAY RESPONSE back and forth between the two, allowing the delay to be measured. Once the delay is known, the Slave can adjust its frequency and time to be synchronized with the Master.
Ideally the delay between the Master and the Slave is constant, for example when using a wire. In a real world network, there are Layer 2 and/or Layer 3 devices in between which make the delay variable. If the network devices in between the master and the slave are working as a transparent clock, they add correction values to certain PTP messages, which assists the Slave in removing this variable delay.
Peer to Peer (P2P):
This delay mechanism requires each network element to measure the delay between its input port and the device attached on the other end of the wire of this input port (the peer device). As the Master sends its view of time (using SYNC messages) towards Slave(s), each network element along the way receives the SYNC message and adds a correction to the SYNC message. The correction includes the measured wire delay of the input port the SYNC message was received on. For Transparent Clocks, the correction also includes the delay through the bridge. This correction is cumulative as it traverses nodes hop-by-hop. As the SYNC message finally arrives at a Slave, the accumulative correction in the SYNC message will contain the total delay from the Master to the Slave. This eliminates the Slave from having to send messages back and forth with the Master. Peer-to-Peer is a newer IEEE 1588 technology, and not all devices deployed today support Peer-to-Peer.
3.3.2. Multicast and Unicast configuration
Originally, PTP is defined as multicast. The BMCA uses multicast messages to find the grandmaster and only with multicast, the slave is able to find the master by itself without user configuration.
In bigger networks, multicast communication produces significantly more traffic and some networks are not supporting multicast for different reason. In these cases, unicast operation is a possible solution. With unicast communication, the slave needs to know the address of the master beforehand (by user configuration): The slave needs a list of possible master – acceptable master table – to know, where he can take its time from.
|✅ Self-configuration with BMCA|
❌ Some networks block multicast
|✅ less network traffic|
❌ pre configuration of masters needed
3.3.3. Layer 2 and Layer 3
Layer 2 defines the protocol to both establish and terminate a physical connection between two devices. Under IEEE 802, Layer 2 can be divided into two sublayers. The MAC approves devices to access and transmit media, while the Logical Link Layer (LLC) first identifies protocols on the network layer and then checks for errors and frame synchronization.
Where Layer 3 works with IP addresses, Layer 2 works with MAC addresses. MAC addresses are unique identifiers for the network adaptor present in each device. As IP addresses are a layer of abstraction higher than MAC addresses, they are necessarily ‘slower’ (theoretically – to our human experience, it’s academic). IP addresses are also ‘leased’ or ‘assigned’ generally by a DHCP server. A MAC address is a fixed address to the network adaptor and can’t be changed on a device without changing the hardware adaptor.
PTPv2 provides the possibility to run with UDP (ISO/OSI Layer 3, Ethertype: UDP x0800) or direct on ethernet (Layer 2, Ethertype x88F7).
3.3.4. 1-Step and 2-Step configuration
The key of the accuracy of IEEE 1588 is the ability to time stamp PTP messages as close as possible to entering and leaving the physical interface. High accuracy is only possible if hardware is used to capture the time stamps. There are two types of time stamping modes used, 1-step and 2-step:
The time stamp is captured in real time as the message starts transmitting out the physical port and as the message is transmitted the time stamp is added on the fly.
2- Step mode
The time stamp is captured in real time as the message starts transmitting out the physical port, but the time stamp is not added on the fly to this message. A secondary message is used instead to carry the captured time stamp.
Older implementations of IEEE 1588v2 used the 2-step time stamping mode, as the hardware was unable to add the timestamp on the fly. Most modern implementations support the 1-Step time stamping mode.
3-Best Master Clock Algorithm:
In a PTP domain all nodes listen for so called «Announce» message:
An Announce message contains quality and priority information of the Clock which sends it
- When no «Announce» messages was received for a defined interval the nodes become Master and start to send their own «Announce» messages
- If a node receives an «Announce» message which is better by its quality, the node stops to send «Announce» messages and becomes Slave
- If a node receives an «Announce» message which is worse by its quality, the node stays in Master and continues to send «Announce» messages in a defined interval
- When the network has determined the best node in the network, this is the only one sending Announce messages => 1 Master, N Slaves
- This algorithm runs all the time, means if another node becomes better or the current Master gets worse than another node the topology changes
- This algorithm is called Best Master Clock Algorithm (BMCA)
3.3.5. Message intervals and timeouts
PTP defines three different intervals, which can be configured for the different type of messages (described in chapter 3.1):
The interval for the announce message is configurable from 2-7 to 27 seconds.
With this range the announce message can be sent form 128 times per second to once every 128 seconds.
If not otherwise defined the setting 1 is used, where every 2 seconds announce messages are sent out.
For the sync interval the same range as for the announce message is configurable.
The default setting 0 is used, where every second sync messages are sent out.
Delay Request interval
For the delay request interval the same range as for the announce message is configurable.
The default setting 0 is used, where every second delay request messages are sent out.
A PTP-profile is a selection of optional features and attribute values. The purpose of a profile is to set restrictions on the possible PTP attributes to simplify the interoperability between different PTP devices in a certain application.
IEEE 1588 has defined two default PTP profiles:
End-to-End synchronisation on Layer 3 (see chapter 2.3)
Peer-to-Peer synchronisation on Layer 2 (see chapter 2.4)
Further profiles are defined by different industries for their specific applications.
IEEE 61850-9-3(Power Utility Profile), EEE C37.238 (power profile)
Frequency Profile defined in ITU-T G.8265.1, Phase Profile defined in ITU-T G.8275.1 & G.8275.2
SMPTE ST 2059-2 2015
TSN (Broadcast, Automation):
4. Comparison – NTP vs. PTP
DISCLAIMER: The information below is not generally valid. The comparison is requirements specific and may differ in actual applications! An attempt was made to contrast the basic factors. The basic factors were compared against each other in order to show the advantages of the respective protocoll. It is important to understand that there is no clear dividing line and that the application ultimately determines the choice of protocol.
Both NTP and PTP time servers use network time protocols to serve time to other devices on the network and achieve time synchronization.
►NTP used for ‘application level’ synchronization
- Coarse level granularity
- Requirement for synchronization guarantee does not exist
- Example: time-stamping error log files
►PTP used for precision synchronization
- Mission critical applications
- Dedicated hardware to minimize on-path issues
- High end algorithms to eliminate network & equipment jitter
4.1. Network traffic
The load of both protocols depends mostly on the configured settings.
4.2. Number of clients
Using the Multicast mode, there is basically no limit for the number of clients. The NTP time packet is sent out to all clients at once, therefore the number of clients is not relevant for the server and does not increase its load.
In Unicast mode, the NTP server needs to answer every request from a client individually. Powerful state of the art NTP servers are capable of answering several thousand requests per second without reducing the accuracy.
For the client itself the number of other clients in the network is not relevant.
Mostly PTP is using multicast communication and therefore the network load is increasing with every connected device. Each device needs to be capable of handling all the transferred multicast messages in the network.
In this configuration, the maximum number of clients is depending on all connected devices not only the master. If unicast mode is used, this limitation is removed and the limit is only defined by the Grandmaster. Grandmasters are capable of answering several thousand requests per second without reducing the accuracy. Overall the number of clients, which can be handled is highly depending on the Intervals configured.
4.3. Which is the right protocol for your application?
DISCLAIMER: The information below is not generally valid. It is important to understand that there is no clear dividing line and that the application ultimately determines the choice of protocol.
Both, PTP and NTP provides time synchronization over a packet-based network. But not both protocols are dedicated to the same applications. It depends on the system’s needs, which of the protocol is preferred.
NTP is the choice for all applications, for which a synchronization accuracy in the range of Milliseconds is sufficient. For those applications, NTP is the simplest and most economical solution. It is reliable, robust and simple to configure. NTP does not require any special configurations or equipment in the underlying network.
Typical NTP Applications are:
- Synchronization of clocks
PTP is needed where a higher level of precision is required. With PTP sub microsecond or even nanosecond accuracies are feasible. The key of PTP is hardware timestamping. Only if the timestamping happens close to the wire, it is possible to reach this high level of accuracy. The drawback of it is the need for dedicated hardware and an engineered network.
Typical PTP Applications are:
- Telecom – Synchronization of the base stations
- Traffic control – synchronization of different control equipment or different sites
- Broadcast – synchronization of audio and video equipment
- Energy – Synchronization of substations
- Banking – Synchronization for high speed trading
5. How can Mobatime support?
MOBATIME provide NTP and PTP products, which offers highly precise interfaces such as PRC, PTP IEEE1588 V2, NTP, etc. with an advantage of precision in accuracy as well as traceability. Grandmasters and Time Server are equipped with crystal or atomic oscillators to provide time, pulse, phase & frequency solutions supporting synchronization using Global Navigation Satellite System for a mid or large infrastructure network.
NTP Time Servers synchronize your networks with high precision and reliability. All systems in the IT network have the exact time thanks to synchronization via NTP. Events can therefore be arranged chronologically thanks to precise time stamps.
- high-precision time for all network environments
- NTP (Network Time Protocol) time server for various applications
- Combination time server master clock for use in complex clock systems
PTP Grandmasters are combined time and synchronization systems that stand for maximum precision and availability. They can be used as IEEE-1588 PTP grandmasters and thus meet the basic requirements for compliance with the strict MiFID II time accuracy specifications in the field of high-frequency trading, for example.
- extremely stable and high-precision thanks to rubidium oscillators
- very accurate in freewheel mode
- PTP (Precision Time Protocol) time server for various applications
created by Felix Mosimann | 21.04.2022