Precision Time Protocol
The Precision Time Protocol (PTP) is a protocol used to synchronize clocks throughout a computer network. On a local area network, it achieves clock accuracy in the sub-microsecond range, making it suitable for measurement and control systems.
PTP was originally defined in the IEEE 1588-2002 standard, officially entitled "Standard for a Precision Clock Synchronization Protocol for Networked Measurement and Control Systems" and published in 2002. In 2008, IEEE 1588-2008 was released as a revised standard; also known as PTP Version 2, it improves accuracy, precision and robustness but is not backward compatible with the original 2002 version.
"IEEE 1588 is designed to fill a niche not well served by either of the two dominant protocols, NTP and GPS. IEEE 1588 is designed for local systems requiring accuracies beyond those attainable using NTP. It is also designed for applications that cannot bear the cost of a GPS receiver at each node, or for which GPS signals are inaccessible."
The IEEE 1588 standards describe a hierarchical master-slave architecture for clock distribution. Under this architecture, a time distribution system consists of one or more communication media (network segments), and one or more clocks. An ordinary clock is a device with a single network connection and is either the source of (master) or destination for (slave) a synchronization reference. A boundary clock has multiple network connections and can accurately synchronize one network segment to another. A synchronization master is selected for each of the network segments in the system. The root timing reference is called the grandmaster. The grandmaster transmits synchronization information to the clocks residing on its network segment. The boundary clocks with a presence on that segment then relay accurate time to the other segments to which they are also connected.
A simplified PTP system frequently consists of ordinary clocks connected to a single network, and no boundary clocks are used. A grandmaster is elected and all other clocks synchronize directly to it.
IEEE 1588-2008 introduces a clock associated with network equipment used to convey PTP messages. The transparent clock modifies PTP messages as they pass through the device. Timestamps in the messages are corrected for time spent traversing the network equipment. This scheme improves distribution accuracy by compensating for delivery variability across the network.
PTP typically uses the same epoch as Unix time (start of 1 January 1970).[note 1] While the Unix time is based on Coordinated Universal Time (UTC) and is subject to leap seconds, PTP is based on International Atomic Time (TAI). The PTP grandmaster communicates the current offset between UTC and TAI, so that UTC can be computed from the received PTP time.
Synchronization and management of a PTP system is achieved through the exchange of messages across the communications medium. To this end, PTP uses the following message types.
- Sync, Follow_Up, Delay_Req and Delay_Resp messages are used by ordinary and boundary clocks and communicate time-related information used to synchronize clocks across the network.
- Pdelay_Req, Pdelay_Resp and Pdelay_Resp_Follow_Up are used by transparent clocks to measure delays across the communications medium so that they can be compensated for by the system. Transparent clocks and these messages associated with them are not available in IEEE 1588-2002.
- Announce messages are used by the best master clock algorithm in IEEE 1588-2008 to build a clock hierarchy and select the grandmaster.[note 2]
- Management messages are used by network management to monitor, configure and maintain a PTP system.
- Signaling messages are used for non-time-critical communications between clocks. Signaling messages were introduced in IEEE 1588-2008.
Messages are categorized as event and general messages. Event messages are time-critical in that accuracy in transmission and receipt timestamp accuracy directly affects clock distribution accuracy. Sync, Delay_Req, Pdelay_Req and Pdelay_resp are event messages. General messages are more conventional protocol data units in that the data in these messages is of importance to PTP, but their transmission and receipt timestamps are not. Announce, Follow_Up, Delay_Resp, Pdelay_Resp_Follow_Up, Management and Signaling messages are members of the general message class.:Clause 6.4
PTP messages may use the User Datagram Protocol over Internet Protocol (UDP/IP) for transport. IEEE 1588-2002, uses only IPv4 transports,:Annex D but this has been extended to include IPv6 in IEEE 1588-2008.:Annex F In IEEE 1588-2002, all PTP messages are sent using multicast messaging, while IEEE 1588-2008 introduced an option for devices to negotiate unicast transmission on a port-by-port basis.:Clause 16.1 Multicast transmissions use IP multicast addressing, for which multicast group addresses are defined for IPv4 and IPv6 (see table).:Annex D and E Event messages are sent to port number 319. General messages use port number 320.
|Messages||IPv4||IPv6||IEEE 802.3 Ethernet:Annex F[note 3]|
|All except peer delay messages||188.8.131.52[note 4]||FF0x::181[note 5]||01-1B-19-00-00-00[note 6]|
|Peer delay messages: Pdelay_Req, Pdelay_Resp and Pdelay_Resp_Follow_Up[note 7]||184.108.40.206[note 8]||FF02::6B||01-80-C2-00-00-0E|
A domain[note 9] is an interacting set of clocks that synchronize to one another using PTP. Clocks are assigned to a domain by virtue of the contents of the Subdomain name (IEEE 1588-2002) or the domainNumber (IEEE 1588-2008) fields in PTP messages they receive or generate. Domains allow multiple clock distribution systems to share the same communications medium.
|Subdomain name field contents (IEEE1588-2002)||IPv4 multicast address
|_ALT1||220.127.116.11||1||Alternate domain 1|
|_ALT2||18.104.22.168||2||Alternate domain 2|
|_ALT3||22.214.171.124||3||Alternate domain 3|
|Application specific up to 15 octets:Clause 126.96.36.199||188.8.131.52, 131 or 132 as per hash function on Subdomain name:Annex C||4 through 127||User-defined domains|
Best master clock algorithm
The best master clock (BMC) algorithm performs a distributed selection of the best candidate clock based on the following clock properties:
- Identifier – A universally unique numeric identifier for the clock. This is typically constructed based on a device's MAC address.
- Quality – Both versions of IEEE 1588 attempt to quantify clock quality based on expected timing deviation, technology used to implement the clock or location in a clock stratum schema, although only V1 (IEEE 1588-2002) knows a data field stratum. PTP V2 (IEEE 1588-2008) defines the overall quality of a clock by using the data fields clockAccuracy and clockClass.
- Priority – An administratively assigned precedence hint used by the BMC to help select a grandmaster for the PTP domain. IEEE 1588-2002 used a single boolean variable to indicate precedence. IEEE 1588-2008 features two 8-bit priority fields.
- Variance – A clock's estimate of its stability based on observation of its performance against the PTP reference.
IEEE 1588-2008 uses a hierarchical selection algorithm based on the following properties, in the indicated order::Figure 27
- Priority 1 – the user can assign a specific static-designed priority to each clock, preemptively defining a priority among them. Smaller numeric values indicate higher priority.
- Class – each clock is a member of a given class, each class getting its own priority.
- Accuracy – precision between clock and UTC, in nanoseconds (ns)
- Variance – variability of the clock
- Priority 2 – final-defined priority, defining backup order in case the other criteria were not sufficient. Smaller numeric values indicate higher priority.
- Unique identifier – MAC address-based selection is used as a tiebreaker when all other properties are equal.
IEEE 1588-2002 uses a selection algorithm based on similar properties.
Clock properties are advertised in IEEE 1588-2002 Sync messages and in IEEE 1588-2008 Announce messages. The current clock master transmits this information at regular interval. A clock which considers itself a better master clock will transmit this information in order to invoke a change of master clock. Once the current master recognises the better clock, the current master stops transmitting Sync messages and associated clock properties (Announce messages in the case of IEEE 1588-2008) and the better clock takes over as master.. The BMC algorithm only considers the self-declared quality of clocks and does not take network link quality into consideration.
Through use of the BMC algorithm, PTP selects a master source of time for an IEEE 1588 domain and for each network segment in the domain.
Clocks determine the offset between themselves and their master. Let the variable represent physical time. For a given slave device, the offset at time is defined by:
where represents the time measured by the slave clock at physical time , and represents the time measured by the master clock at physical time .
The master periodically broadcasts the current time as a message to the other clocks. Under IEEE 1588-2002 broadcasts are up to once per second. Under IEEE 1588-2008, up to 10 per second are permitted.
Each broadcast begins at time with a Sync message sent by the master to all the clocks in the domain. A clock receiving this message takes note of the local time when this message is received.
The master may subsequently send a multicast Follow_Up with accurate timestamp. Not all masters have the ability to present an accurate timestamp in the Sync message. It is only after the transmission is complete that they are able to retrieve an accurate timestamp for the Sync transmission from their network hardware. Masters with this limitation use the Follow_Up message to convey . Masters with PTP capabilities built into their network hardware are able to present an accurate timestamp in the Sync message and do not need to send Follow_Up messages.
In order to accurately synchronize to their master, clocks must individually determine the network transit time of the Sync messages. The transit time is determined indirectly by measuring round-trip time from each clock to its master. The clocks initiate an exchange with their master designed to measure the transit time . The exchange begins with a clock sending a Delay_Req message at time to the master. The master receives and timestamps the Delay_Req at time and responds with a Delay_Resp message. The master includes the timestamp in the Delay_Resp message.
Through these exchanges a clock learns , , and .
If is the transit time for the Sync message, and is the constant offset between master and slave clocks, then
Combining the above two equations, we find that
The clock now knows the offset during this transaction and can correct itself by this amount to bring it into agreement with their master.
One assumption is that this exchange of messages happens over a period of time so small that this offset can safely be considered constant over that period. Another assumption is that the transit time of a message going from the master to a slave is equal to the transit time of a message going from the slave to the master. Finally, it is assumed that both the master and slave can accurately measure the time they send or receive a message. The degree to which these assumptions hold true determines the accuracy of the clock at the slave device.:Clause 6.2
IEEE 1588-2008 standard lists the following set of features that implementations may choose to support:
- Alternate Time-Scale
- Grand Master Cluster
- Unicast Masters
- Alternate Master
- Path Trace
- The International IEEE Symposium on Precision Clock Synchronization for Measurement, Control and Communication (ISPCS) is an IEEE organized annual event that includes a plugtest and a conference program with paper and poster presentations, tutorials and discussions covering several aspects of PTP
- The Institute of Embedded Systems (InES) of the Zurich University of Applied Sciences/ZHAW is addressing the practical implementation and application of PTP
- IEEE 1588 is a key technology in the LXI Standard for Test and Measurement communication and control
- IEEE 802.1AS-2011 is part of the IEEE Audio Video Bridging (AVB) group of standards, further extended by the IEEE 802.1 Time-Sensitive Networking (TSN) Task Group. It specifies a profile for use of IEEE 1588-2008 for time synchronization over a virtual bridged local area network (as defined by IEEE 802.1Q). In particular, 802.1AS defines how IEEE 802.3 (Ethernet), IEEE 802.11 (Wi-Fi), and MoCA can all be parts of the same PTP timing domain.
- SMPTE 2059-2 is a PTP profile for use in synchronization of broadcast media systems
- The AES67 audio networking interoperability standard includes a PTP profile compatible with SMPTE ST2059-2
- The White Rabbit Project combines Synchronous Ethernet and PTP
- Precision Time Protocol Industry Profile PTP profiles (L2P2P and L3E2E) for industrial automation in IEC 62439-3
- IEC/IEEE 61850-9-3 PTP profile for substation automation adopted by IEC 61850
- Parallel Redundancy Protocol use of PTP profiles (L2P2P and L3E2E) for industrial automation in parallel networks
- The profile capability under IEEE 1588-2008 allows the use of application-specific epochs.:Annex B
- In IEEE 1588-2002, information carried by Announce messages is carried in the Sync messages. In IEEE 1588-2008, the Sync message has been optimized and this information is no longer carried here.
- PTP over IEEE 802.3 Ethernet uses Ethertype 0x88F7
- IEEE 1588-2002 non-default domains use destination addresses 184.108.40.206 through 220.127.116.11 (see #Domains).
- Where x is the address scope (2 for link-local) as per RFC 2373 (see IPv6 multicast address)
- In some PTP applications it is permissible to send all PTP messages to 01-1B-19-00-00-00
- Peer delay messages are intended to propagate to the immediately connected neighbor. The multicast addresses for these messages are designed to be link-local in scope and are not passed through a router. IEEE 1588-2008 also recommends setting time to live to 1 (IPv4) or hop limit to 0 (IPv6) as further insurance that the messages will not be routed.
- Peer delay messaging is not present in IEEE 1588-2002
- IEEE 1588-2002 defined a domain as any interconnected set of clocks (regardless of whether they synchronized to one another) and used subdomain to refer to what is known as a domain in IEEE 1588-2008.
- IEEE 1588-2008 uses 18.104.22.168 as the address for all multicast messages.
- Eidson, John (10 October 2005). "IEEE-1588 Standard for a Precision Clock Synchronization Protocol for Networked Measurement and Control Systems, a Tutorial" (PDF). National Institute of Standards and Technology (NIST).
- Eidson, John (2 October 2006). "IEEE 1588 Standard Version 2 - A Tutorial". Archived from the original (PDF) on 18 June 2010.
- Eidson, John C. (April 2006). Measurement, Control and Communication Using IEEE 1588. Springer. ISBN 1-84628-250-0.
- "Meanings of common terms used in IEEE 1588". Nation Institute or Standards and Technologies. Archived from the original on 17 June 2010.
- IEEE 1588-2008, IEEE, 24 July 2008, doi:10.1109/IEEESTD.2008.4579760
- IEEE 1588-2002, IEEE, 8 November 2002, doi:10.1109/IEEESTD.2002.94144
- Steve T. Watt, Shankar Achanta, Hamza Abubakari, and Eric Sagen (March 2014), Understanding and Applying Precision Time Protocol (PDF), retrieved 2017-09-09
- FSMLabs Technical Staff (September 2015), Smart and Dumb PTP Client and the "so-called"Best Master Clock Algorithm, retrieved 2018-05-17
- International standard IEC 61588: Precision clock synchronization protocol for networked measurement and control systems. 2004.
- ISPCS website
- SMPTE Publishes First Two Parts of Standard Enabling Deployment of PTP-Timed Equipment in Existing SDI Plants, Society of Motion Picture and Television Engineers, 2015-04-13, retrieved 2015-05-21
- AES-R16-2016: AES Standards Report - PTP parameters for AES67 and SMPTE ST 2059-2 interoperability, Audio Engineering Society, 2016-05-02
- NIST IEEE 1588 site
- PTP documentation at InES
- PTP and Synchronization of LTE mobile networks
- Hirschmann PTP Whitepaper
- PTP overview in Cisco CGS 2520 Switch Software Configuration Guide
- Perspectives and priorities on RuggedCom Smart Grid Research IEC 61850 Technologies
- Projects with Smart Substation Solution
- Smart High Voltage Substation Based on IEC 61850 Process Bus and IEEE 1588 Time Synchronization
- Test and evaluation system for multi-protocol sampled value protection schemesby Dave Ingram
- PTP explained under the installation / maintenance point of view
- The White Rabbit Project PTP
- IEC&IEEE Precision Time Protocol, Pacworld, September 2016]
- Tutorial on the fault-tolerant precision time protocol profiles in IEC 62439-3
- IEC 62439-3 Annexes A-E Redundant attachment of clocks and network management
- PTPv2 Timing protocol in AV networks
- FSMLabs: Single source IEEE PTP 1588 cannot meet financial regulatory standards