forked from richardcochran/linuxptp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phc2sys.8
231 lines (213 loc) · 6.55 KB
/
phc2sys.8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
.TH PHC2SYS 8 "November 2012" "linuxptp"
.SH NAME
phc2sys \- synchronize two clocks
.SH SYNOPSIS
.B phc2sys
[
.B \-wmqvx
] [
.BI \-d " pps-device"
] [
.BI \-s " device"
] [
.BI \-c " device"
] [
.BI \-O " offset"
] [
.BI \-P " kp"
] [
.BI \-I " ki"
] [
.BI \-S " step"
] [
.BI \-F " step"
] [
.BI \-R " update-rate"
] [
.BI \-N " clock-readings"
] [
.BI \-u " summary-updates"
] [
.BI \-n " domain-number"
] [
.BI \-l " print-level"
]
.SH DESCRIPTION
.B phc2sys
is a program which synchronizes two clocks in the system. Typically, it is used
to synchronize the system clock to a PTP hardware clock (PHC), which itself is
synchronized by the
.BR ptp4l (8)
program.
Two synchronization modes are supported, one uses a pulse per second (PPS)
signal provided by the source clock and the other mode reads time from the
source clock directly. Some clocks can be used in both modes, the mode which
will synchronize the slave clock with better accuracy depends on hardware and
driver implementation.
.SH OPTIONS
.TP
.BI \-d " pps-device"
Specify the PPS device of the master clock (e.g. /dev/pps0). With this option
the PPS synchronization mode is used instead of the direct mode. As the PPS
signal does not specify time and only marks start of a second, the slave clock
should be already close to the correct time before
.B phc2sys
is started or the
.B \-s
option should be used too. This option can be used only with the system clock as
the slave clock.
.TP
.BI \-s " device"
Specify the master clock by device (e.g. /dev/ptp0) or interface (e.g. eth0) or
by name (e.g. CLOCK_REALTIME for the system clock). When this option is used
together with the
.B \-d
option, the master clock is used only to correct the offset by whole number of
seconds, which cannot be fixed with PPS alone.
.TP
.BI \-i " interface"
Performs the exact same function as
.B \-s
for compatibility reasons. Previously enabled specifying master clock by network
interface. However, this can now be done using
.B \-s
and this option is no longer necessary. As such it has been deprecated, and
should no longer be used.
.TP
.BI \-c " device"
Specify the slave clock by device (e.g. /dev/ptp1) or interface (e.g. eth1) or
by name. The default is CLOCK_REALTIME (the system clock).
.TP
.BI \-P " kp"
Specify the proportional constant of the PI controller. The default is 0.7.
.TP
.BI \-I " ki"
Specify the integral constant of the PI controller. The default is 0.3.
.TP
.BI \-S " step"
Specify the step threshold of the PI controller. It is the maximum offset that
the controller corrects by changing the clock frequency instead of stepping the
clock. The clock is stepped on start regardless of the option if the offset is
larger than 100 nanoseconds (unless the
.BI \-F
option is used). The value of 0.0 disables stepping after the start. The default
is 0.0.
.TP
.BI \-F " step"
Specify the step threshold applied only on the first update. It is the maximum
offset that is corrected by adjusting clock. The value of 0.0 disables stepping
on start. The default is 0.0000001 (100 nanoseconds).
.TP
.BI \-R " update-rate"
Specify the slave clock update rate when running in the direct synchronization
mode. The default is 1 per second.
.TP
.BI \-N " phc-num"
Specify the number of master clock readings per one slave clock update. Only
the fastest reading is used to update the slave clock, this is useful to
minimize the error caused by random delays in scheduling and bus utilization.
The default is 5.
.TP
.BI \-O " offset"
Specify the offset between the slave and master times in seconds. See
.SM
.B TIME SCALE USAGE
below.
.TP
.BI \-u " summary-updates"
Specify the number of clock updates included in summary statistics. The
statistics include offset root mean square (RMS), maximum absolute offset,
frequency offset mean and standard deviation, and mean of the delay in clock
readings and standard deviation. The units are nanoseconds and parts per
billion (ppb). If zero, the individual samples are printed instead of the
statistics. The messages are printed at the LOG_INFO level.
The default is 0 (disabled).
.TP
.B \-w
Wait until ptp4l is in a synchronized state. If the
.B \-O
option is not used, also keep the offset between the slave and master
times updated according to the currentUtcOffset value obtained from ptp4l and
the direction of the clock synchronization.
.TP
.BI \-n " domain-number"
Specify the domain number used by ptp4l. The default is 0.
.TP
.B \-x
When a leap second is announced, don't apply it in the kernel by stepping the
clock, but let the servo correct the one-second offset slowly by changing the
clock frequency (unless the
.B \-S
option is used).
.TP
.BI \-l " print-level"
Set the maximum syslog level of messages which should be printed or sent to
the system logger. The default is 6 (LOG_INFO).
.TP
.B \-m
Print messages to the standard output.
.TP
.B \-q
Don't send messages to the system logger.
.TP
.BI \-h
Display a help message.
.TP
.B \-v
Prints the software version and exits.
.SH TIME SCALE USAGE
.B Ptp4l
uses either PTP time scale or UTC (Coordinated Universal Time) time
scale. PTP time scale is continuous and shifted against UTC by a few tens of
seconds as PTP time scale does not apply leap seconds.
In hardware time stamping mode,
.B ptp4l
announces use of PTP time scale and PHC
is used for the stamps. That means PHC must follow PTP time scale while system
clock follows UTC. Time offset between these two is maintained by
.BR phc2sys .
.B Phc2sys
acquires the offset value either by reading it from ptp4l when
.B \-w
is in effect or from command line when
.B \-O
is supplied. Failure to maintain the correct offset can result in local system
clock being off some seconds to domain master system clock when in slave mode,
or incorect PTP time announced to the network in case the host is the domain
master.
.SH EXAMPLES
The host is a domain master, PTP clock is synchronized to system clock and the
time offset is obtained from
.BR ptp4l .
.B Phc2sys
waits for
.B ptp4l
to get at least one port in master or slave mode before starting the
synchronization.
.RS
\f(CWphc2sys \-c /dev/ptp0 \-s CLOCK_REALTIME \-w\fP
.RE
Same as above, time offset is provided on command line and
.B phc2sys
does not wait for
.BR ptp4l .
.RS
\f(CWphc2sys \-c /dev/ptp0 \-s CLOCK_REALTIME \-O 35\fP
.RE
The host is in slave mode, system clock is synchronized from PTP clock,
.B phc2sys
waits for
.B ptp4l
and the offset is set automatically.
.RS
\f(CWphc2sys \-s /dev/ptp0 \-w\fP
.RE
Same as above, PTP clock id is read from the network interface, the offset is
provided on command line
.B phc2sys
does not wait.
.RS
\f(CWphc2sys \-s eth0 \-O \-35\fP
.RE
.SH SEE ALSO
.BR ptp4l (8)