Precision Time Protocol on Linux 
~ Introduction to linuxptp 
Ken ICHIKAWA 
FUJITSU LIMITED. 
LinuxCon Japan 2014 
Copyright 2014 FUJITSU LIMITED 
Agenda 
 Background 
 Overview of Precision Time Protocol (PTP) 
 About PTP on Linux 
 Tips 
 For easy trial or development 
 
3 
Copyright 2014 FUJITSU LIMITED 
Background 
 Event ordering is very important 
 for incident analysis, performance analysis and so on  
 Event ordering is based on timestamps 
 Timestamps are collected from multiple servers 
⇒Clock synchronization is important 
 If precision and accuracy of clock 
synchronization are bad, event ordering can 
reverse against actual time 
Event 2 
Event 1 
Event 3 
Server A 
Server B 
4 
Copyright 2014 FUJITSU LIMITED 
NTP is not enough 
 NTP provides millisecond level synchronization 
 Maybe enough for remote machines, but not enough for 
locally cooperating machines 
 Many events occur in a millisecond in multiple servers 
⇒Event ordering will frequently reverse 
 
 Need another protocol 
 Higher precision and accuracy 
 Not need to synchronize large area, but local servers 
and devices 
5 
Copyright 2014 FUJITSU LIMITED 
Example of wrong event ordering 
Actual Time 
2 
3 
4 
5 
6 
7 
8 
Server A 
diff:-1 
1 
Server B 
diff:+3 
5 
2 
3 
4 
5 
6 
7 
Event 1 
Event 2 
Event 3 
6 
7 
8 
9 
10 
11 
time 
Event Ordering based on Actual Time 
Event Ordering based on Timestamp 
Time 
Event 
Time 
Event 
3  
5  
7  
Event 1 
Event 2 
Event 3 
2  
6  
8  
Event 1 
Event 3 
Event 2 
reverse! 
6 
Copyright 2014 FUJITSU LIMITED 
Example of correct event ordering 
based on better clock synchronization 
Actual Time 
2 
3 
4 
5 
6 
7 
8 
Server A 
diff:-0.001 
1.999 
Server B 
diff:+0.003 
2.003 
2.999  3.999 
4.999 
5.999 
6.999 
7.999 
Event 1 
Event 2 
Event 3 
3.003  4.003 
5.003 
6.003 
7.003 
8.003 
time 
Event Ordering based on Actual Time 
Event Ordering based on Timestamp 
Time 
Event 
3  
5  
7  
Event 1 
Event 2 
Event 3 
Time 
2.999  
5.003  
6.999  
Event 
Event 1 
Event 2 
Event 3 
correct! 
7 
Copyright 2014 FUJITSU LIMITED 
Agenda 
 Background 
 Overview of Precision Time Protocol (PTP) 
 What’s PTP 
 Term explanation 
 About packet timestamp 
 About PTP on Linux 
 Tips 
 For easy trial or development 
 
8 
Copyright 2014 FUJITSU LIMITED 
Precision Time Protocol (PTP) 
 Standardized protocol, IEEE1588 
 Synchronize the clocks in local computing systems 
and devices 
 Microsecond to sub-microsecond accuracy and 
precision 
 Administration free 
 Capability to autonomously decide time server(master) 
• called Best Master Clock Algorithm (BMCA) 
9 
Copyright 2014 FUJITSU LIMITED