DOKK / manpages / debian 12 / linuxptp / ts2phc.8.en
TS2PHC(8) System Manager's Manual TS2PHC(8)

ts2phc - Synchronizes one or more PTP Hardware Clocks using external time stamps.

ts2phc [ -hmqv ] [ -c device|name ] [ -f config ] [ -l print-level ] [ -s device|name ] [ long-options ] ...

ts2phc synchronizes PTP Hardware Clocks (PHC) to external time stamp signals. A single source may be used to distribute time to one or more PHC devices.

Specifies a PHC slave clock to be synchronized. The clock may be identified by its character device (like /dev/ptp0) or its associated network interface (like eth0). This option may be given multiple times.
Read configuration from the specified file. No configuration file is read by default.
Displays the command line help summary.
Sets the maximum syslog level of messages which should be printed or sent to the system logger. The default is 6 (LOG_INFO).
Prints log messages to the standard output.
Prevents sending log messages to the system logger.
Specifies the source of the PPS signal. Use the key word "generic" for an external 1-PPS without ToD information. When using a master PHC, the clock may be identified by its character device (like /dev/ptp0) or its associated network interface (like eth0). Use the key word "nmea" for an external 1-PPS from a GPS providing ToD information via the RMC NMEA sentence.
Prints the software version and exits.

Each and every configuration file option (see below) may also appear as a "long" style command line argument. For example, the use_syslog option may be set using either of these two forms.

--use_syslog 1 --use_syslog=1

Option values given on the command line override values in the global section of the configuration file.

The configuration file is divided into sections. Each section starts with a line containing its name enclosed in brackets and it follows with settings. Each setting is placed on a separate line, it contains the name of the option and the value separated by whitespace characters. Empty lines and lines starting with # are ignored.

There are two different section types.

1.
The global section (indicated as [global]) sets the program options and default slave clock options. Other sections are clock specific sections, and they override the default options.
2.
Slave clock sections give the name of the configured slave (e.g. [eth0]). Slave clocks specified in the configuration file need not be specified with the -c command line option.

The maximum offset, specified in seconds, that the servo will correct by changing the clock frequency instead of stepping the clock. This is only applied on the first update. When set to 0.0, the servo will not step the clock on start. The default is 0.00002 (20 microseconds).
When set to 1, no the slave clock will be adjusted. This option can be useful in test scenarios, for example to determine how well synchronized a group of local clocks are to each other. The default is 0 (adjust the slave clocks).
The path to the current leap seconds definition file. In a Debian system this file is provided by the tzdata package and can be found at /usr/share/zoneinfo/leap-seconds.list. The default is an empty string, which causes the program to use a hard coded table that reflects the known leap seconds on the date of the software's release.
The maximum logging level of messages which should be printed. The default is 6 (LOG_INFO).
The maximum allowed frequency adjustment of the clock in parts per billion. This is an additional limit to the maximum allowed by the hardware. When set to 0, the hardware limit will be used. The default is 900000000 (90%).
The tag which is added to all messages printed to the standard output or system log. The default is an empty string (which cannot be set in the configuration file as the option requires an argument).
The maximum offset, specified in seconds, that the servo will correct by changing the clock frequency instead of stepping the clock. When set to 0.0, the servo will never step the clock except on start. The default is 0.0.
Specifies the serial port character device providing ToD information when using the "nmea" PPS signal source. Note that if these two options are both specified, then the given remote connection will be used in preference to the configured serial port. These options default to the empty string, that is, not specified.
Specifies the serial port character device providing ToD information when using the "nmea" PPS signal source. Note that if the options, ts2phc.nmea_remote_host and ts2phc.nmea_remote_port, are both specified, then the given remote connection will be used in preference to the configured serial port. The default is "/dev/ttyS0".
The expected pulse width of the external PPS signal in nanoseconds. When 'ts2phc.extts_polarity' is "both", the given pulse width is used to detect and discard the time stamp of the unwanted edge. The supported range is 1000000 to 990000000 nanoseconds. The default is 500000000 nanoseconds.
Print messages to the system log if enabled. The default is 1 (enabled).
Print messages to the standard output if enabled. The default is 0 (disabled).

The external time stamping or periodic output channel to be used. Some PHC devices feature programmable pins and one or more time stamping channels. This option allows selecting a particular channel to be used. When using a PHC device as the PPS source, this option selects the periodic output channel. The default is channel 0.
The value, in nanoseconds, to be added to each PPS time stamp. The default is 0 (no correction).
The polarity of the external PPS signal, either "rising" or "falling". Some PHC devices always time stamp both edges. Setting this option to "both" will allow the ts2phc program to work with such devices by detecting and ignoring the unwanted edge. In this case be sure to set 'ts2phc.pulsewidth' to the correct value. The default is "rising".
Setting this option to 1 configures the given PHC device as the source of the PPS signal. The default is 0 for the slave role.
The pin index to be used. Some PHC devices feature programmable pins, and this option allows configuration of a particular pin for the external time stamping or periodic output function. The default is pin index 0.

Be cautious when sharing the same configuration file between ptp4l, phc2sys, and ts2phc. Keep in mind that values specified in the configuration file take precedence over the default values. If an option which is common to the other programs is set in the configuration file, then the value will be applied to all the programs using the file, and this might not be what is expected.

It is recommended to use separate configuration files for ptp4l, phc2sys, and ts2phc in order to avoid any unexpected behavior.

phc2sys(8) ptp4l(8)

December 2019 linuxptp