Este conteúdo não está disponível no idioma selecionado.
23.5. Synchronizing the Clocks
The phc2sys program is used to synchronize the system clock to the
PTP
hardware clock (PHC) on the NIC. The phc2sys service is configured in the /etc/sysconfig/phc2sys
configuration file. The default setting in the /etc/sysconfig/phc2sys
file is as follows: OPTIONS="-a -r"The
-a
option causes phc2sys to read the clocks to be synchronized from the ptp4l application. It will follow changes in the PTP
port states, adjusting the synchronization between the NIC hardware clocks accordingly. The system clock is not synchronized, unless the -r
option is also specified. If you want the system clock to be eligible to become a time source, specify the -r
option twice.
After making changes to
/etc/sysconfig/phc2sys
, restart the phc2sys service from the command line by issuing a command as root
:
~]# service phc2sys restart
Under normal circumstances, use service
commands to start, stop, and restart the phc2sys service.
When you do not want to start phc2sys as a service, you can start it from the command line. For example, enter the following command as
root
:
~]# phc2sys -a -r
The -a
option causes phc2sys to read the clocks to be synchronized from the ptp4l application. If you want the system clock to be eligible to become a time source, specify the -r
option twice.
Alternately, use the
-s
option to synchronize the system clock to a specific interface's PTP
hardware clock. For example:
~]# phc2sys -s eth3 -w
The -w
option waits for the running ptp4l application to synchronize the PTP
clock and then retrieves the TAI to UTC offset from ptp4l.
Normally,
PTP
operates in the International Atomic Time (TAI) timescale, while the system clock is kept in Coordinated Universal Time (UTC). The current offset between the TAI and UTC timescales is 36 seconds. The offset changes when leap seconds are inserted or deleted, which typically happens every few years. The -O
option needs to be used to set this offset manually when the -w
is not used, as follows:
~]# phc2sys -s eth3 -O -36
Once the phc2sys servo is in a locked state, the clock will not be stepped, unless the
-S
option is used. This means that the phc2sys program should be started after the ptp4l program has synchronized the PTP
hardware clock. However, with -w
, it is not necessary to start phc2sys after ptp4l as it will wait for it to synchronize the clock.
The phc2sys program can also be started as a service by running:
~]# service phc2sys start
When running as a service, options are specified in the /etc/sysconfig/phc2sys
file. More information on the different phc2sys options can be found in the phc2sys(8)
man page.
Note that the examples in this section assume the command is run on a slave system or slave port.