1PHC_CTL(8) System Manager's Manual PHC_CTL(8)
2
3
4
6 phc_ctl - directly control PHC device clock
7
8
10 phc_ctl [ options ] <device> [ commands ]
11
12
14 phc_ctl is a program which can be used to directly control a PHC clock
15 device. Typically, it is used for debugging purposes, and has little
16 use for general control of the device. For general control of PHC clock
17 devices, phc2sys (8) should be preferred.
18
19 <device> may be either CLOCK_REALTIME, any /dev/ptpX device, or any
20 ethernet device which supports ethtool's get_ts_info ioctl.
21
22
24 -l print-level
25 Set the maximum syslog level of messages which should be printed
26 or sent to the system logger. The default is 6 (LOG_INFO).
27
28 -q Do not send messages to syslog. By default messages will be
29 sent.
30
31 -Q Do not print messages to standard output. By default messages
32 will be printed.
33
34 -h Display a help message.
35
36 -v Prints the software version and exits.
37
38
40 phc_ctl is controlled by passing commands which take either an optional
41 or required parameter. The commands (outlined below) will control
42 aspects of the PHC clock device. These commands may be useful for
43 inspecting or debugging the PHC driver, but may have adverse side
44 effects on running instances of ptp4l (8) or phc2sys (8)
45
46
47 set seconds
48 Set the PHC clock time to the value specified in seconds.
49 Defaults to reading CLOCK_REALTIME if no value is provided.
50
51 get Get the current time of the PHC clock device.
52
53 adj seconds
54 Adjust the PHC clock by an amount of seconds provided. This
55 argument is required.
56
57 freq ppb
58 Adjust the frequency of the PHC clock by the specified parts per
59 billion. If no argument is provided, it will attempt to read the
60 current frequency and report it.
61
62 cmp Compare the PHC clock device to CLOCK_REALTIME, using the best
63 method available.
64
65 caps Display the device capabilities. This is the default command if
66 no commands are provided.
67
68 wait seconds
69 Sleep the process for the specified period of time, waking up
70 and resuming afterwards. This command may be useful for sanity
71 checking whether the PHC clock is running as expected.
72
73 The arguments specified in seconds are read as double precision
74 floating point values, and will scale to nanoseconds. This means
75 providing a value of 5.5 means 5 and one half seconds. This
76 allows specifying fairly precise values for time.
77
78
80 Read the current clock time from the device
81 phc_ctl /dev/ptp0 get
82
83 Set the PHC clock time to CLOCK_REALTIME
84 phc_ctl /dev/ptp0 set
85
86 Set PHC clock time to 0 (seconds since Epoch)
87 phc_ctl /dev/ptp0 set 0.0
88
89 Quickly sanity check frequency slewing by setting slewing frequency by
90 positive 10%, resetting clock to 0.0 time, waiting for 10 seconds, and
91 then reading time. The time read back should be (roughly) 11 seconds,
92 since the clock was slewed 10% faster.
93 phc_ctl /dev/ptp0 freq 100000000 set 0.0 wait 10.0 get
94
95
97 ptp4l(8) phc2sys(8)
98
99
100
101linuxptp June 2014 PHC_CTL(8)