Precision Time Protocol
-
Upload
steven-kreuzer -
Category
Technology
-
view
172 -
download
0
Transcript of Precision Time Protocol
Why Clocks Drift• Accuracy is determined by the stability of the
oscillator
• No oscillator perfectly generates a specified frequency
• Stability describes how well the oscillator resists fluctuations such as variation in temperature, vibration, supply voltage
Reducing Clock Drift• Use a better oscillator
• TCXO, MCXO, and OCXO
• Atomic beam standard
• Use a time distribution protocol
• GPS, WWVB, IRIG-B
• Daytime, NTP, PTP
What is PTP• IEEE standard to synchronize time across an
ethernet network for systems requiring very high accuracies
• Fills a niche not well served by NTP and GPS
• GPS receivers are expensive or signals are inaccessible
• NTP can be accurate to about a millisecond under ideal conditions
Second
1.000000000000
Millisecond (ms)
0.001000000000
Microsecond (μs)
0.000001000000
Nanosecond (ns)
0.000000001000
Picosecond (ps)
0.000000000001
Synchronization Basics
• Master clock provides synchronization messages that slaves use to correct their local clock
• Sync message is transmitted to all slaves at a fixed interval of between 1 and 64 messages per second, configurable by the master clock
• Four timestamps are captured between the master and slave
Master Clock Slave ClockTim
e
Master Clock Slave ClockTim
eSyncT1
T2
Master Clock Slave ClockTim
eSync
Sync Followup
T1
T2
Master Clock Slave ClockTim
eSync
Sync Followup
Delay Request
T1
T2
T3
T4
Master Clock Slave ClockTim
eSync
Sync Followup
Delay Request
Delay Response
T1
T2
T3
T4
Master to Slave Offset
ms_diff = T2 - T1
Slave to Master Offset
sm_diff =T4 - T3
One Way Delay
owd =(ms_diff + sm_diff) /
2
Slave Clock Offset
offset = ms_diff - owd
-or-
((T2-T1) - (T4 -T3)) / 2
Implementation Methods
GrandmasterClock
SlaveClock
SlaveClock
SlaveClock
SlaveClock
SlaveClock
GPS
Ethernet Switch
Implementation Methods
GrandmasterClock
SlaveClock
SlaveClock
SlaveClock
SlaveClock
SlaveClock
GPS
Transparent Switch
Implementation Methods
GrandmasterClock
SlaveClock
GPS
Transparent Switch
Boundary Clock
SlaveClock
SlaveClock
Boundary Clock
SlaveClock
SlaveClock
Boundary Clock
SlaveClock
PTPd• Complete Implementation of the IEEE-1588
v2 specification for a standard clock
• Very well tested on FreeBSD and Linux
• Supports Mac OS X, NetBSD, OpenBSD and Solaris as well
• BSD License
PTPd Features• Can run as a grandmaster and successfully
service 1000 slaves running at 1 sync/sec and 1 delay/sec
• Can run as a slave on a client
• Uses PCAP/BPF timestamps for enhanced accuracy on FreeBSD
• Provide performance and quality metrics
PTPd Quality Measurement
• Provides a method to examine synchronization by using an external event that all slaves see
• Record the sequence id and arrival time of SYNC packets
• SYNC is multicast so all slaves should see it at the same time
• Post processing shows how well synchronized two slaves are
PTPd 2.3.1 Features• Improved sync and delay filtering with statistical
filters and an advanced outlier filter
• Extensive support for unicast transmission including unicast negotiation
• Improvements to leap second handling: support for leap second announcement in master state, leap seconds file support, support for leap second smearing
• Simple interface failover support
http://github.com/ptpd
pkg install net/ptpd2
Questions