PTP Synchronization principle – 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.
PTP Synchronization principle – 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.
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.