TIMEMASTER(8)
๐ TIMEMASTER(8) ๐
System Manager's Manual ยท timemaster
okay bestie, welcome to the manual page for timemaster, the absolute queen of getting your system clock to vibe with both NTP and PTP. she's giving "I orchestrate daemons for breakfast" energy and honestly? she ate. ๐
โจ NAME โจ
timemaster โ run NTP with PTP as reference clocks ๐๐ฆ
๐ธ SYNOPSIS ๐ธ
timemaster [ -nmqv ] [ -l print-level ] -f file
๐ DESCRIPTION ๐
so like, timemaster is a program that uses ptp4l and phc2sys in combination with chronyd or ntpd to synchronize the system clock to NTP and PTP time sources. no cap. ๐ซถ
the PTP time is provided by phc2sys and ptp4l via the SOCK reference clock to chronyd, or the SHM reference clock to ntpd, which can compare all the time sources and use the best sources to synchronize the system clock. it's literally a whole little friend group of time sources picking the main character. ๐
on start, timemaster reads a configuration file that specifies the NTP and PTP time sources, checks which network interfaces have and share a PTP hardware clock (PHC), generates configuration files for ptp4l and chronyd/ntpd, and starts the ptp4l, phc2sys, chronyd/ntpd processes as needed. then, it waits for a signal to kill the processes, remove the generated configuration files and exit. iconic behavior, honestly. ๐
๐ OPTIONS ๐
-ffile โ specify the path to thetimemasterconfiguration file. ๐-nโ don't start the programs, only print their configuration files and the commands that would be executed if this option wasn't specified. it's the "just show me the fit before I wear it" option. ๐-llevel โ set the maximum syslog level of messages which should be printed or sent to the system logger. the default value is6(LOG_INFO).-mโ print messages to the standard output. ๐ฃ๏ธ-qโ don't send messages to the system logger. ๐คซ-vโ print the software version and exit.-hโ display a help message and exit. ๐
๐ 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. (yes bestie, you can comment your little heart out. ๐ฌ)
sections that can used in the configuration file and options that can be set in them are described below. [note: yes, the original says "can used", we keep it verbatim, no editing the queen's grammar] ๐
๐ [timemaster] ๐
ntp_programโ select which NTP implementation should be used. possible values arechronydandntpd. the default value ischronyd. limitations of the implementations relevant to thetimemasterconfiguration are listed in NOTES. ๐rundirโ specify the directory where should be generatedchronyd,ntpdandptp4lconfiguration files and sockets. the directory will be created if it doesn't exist. the default value is/var/run/timemaster. ๐๏ธfirst_shm_segmentโ specify the first number in a sequence of SHM segments that will be used byptp4landphc2sys. the default value is0. increasing the number can be useful to avoid conflicts with time sources that are not started bytimemaster, e.g.gpsdusing segments number0and1. lowkey a pro move. ๐restart_processesโ enable or disable restarting of processes started bytimemaster. if the option is set to a non-zero value, all processes exceptchronydandntpdwill be automatically restarted when terminated andtimemasteris running for at least one second (i.e. the process did not terminate due to a configuration error). if a process was terminated and is not started again,timemasterwill kill the other processes and exit with a non-zero status. the default value is1(enabled). ๐use_vclocksโ enable or disable synchronization with virtual clocks. if enabled,timemasterwill create virtual clocks running on top of physical clocks needed by configured PTP domains. this enables hardware time stamping for multipleptp4linstances using the same network interface. the default value is-1, which enables the virtual clocks if running on Linux5.18or later. ๐ง
๐ธ [ntp_server address] ๐ธ
the ntp_server section specifies an NTP server that should be used as a time source. the address of the server is included in the name of the section. ๐ฎ
minpoll/maxpollโ specify the minimum and maximum NTP polling interval as powers of two in seconds. the default values are6(64 seconds) and10(1024 seconds) respectively. shorter polling intervals usually improve the accuracy significantly, but they should be used only when allowed by the operators of the NTP service (public NTP servers generally don't allow too frequent queries). if the NTP server is located on the same LAN, polling intervals around4(16 seconds) might give best accuracy. โฑ๏ธ
bestie please, do NOT go spamming public NTP servers with queries, they will not be your bestie back. the operators have rules and we respect them. ๐
iburstโ enable or disable sending a burst of NTP packets on start to speed up the initial synchronization. possible values are1and0. the default value is0(disabled). ๐ฅntp_optionsโ specify extra options that should be added for this source to theserverdirective in the configuration file of the selected NTP implementation. no extra options are added by default. โ
๐ฆ [ptp_domain number] ๐ฆ
the ptp_domain section specifies a PTP domain that should be used as a time source. the PTP domain number is included in the name of the section. the ptp4l instances are configured to run in the clientOnly mode. in this section at least the interfaces option needs to be set, other options are optional. ๐
interfacesโ specify which network interfaces should be used for this PTP domain. a separateptp4linstance will be started for each group of interfaces sharing the same PHC and for each interface that supports only SW time stamping. HW time stamping is enabled automatically. if an interface with HW time stamping is specified also in other PTP domains and virtual clocks are disabled, only theptp4linstance from the first PTP domain will be using HW time stamping. ๐ฐ๏ธntp_pollโ specify the polling interval of theSOCK/SHMreference clock reading samples fromptp4lorphc2sys. it's specified as a power of two in seconds. the default value is2(4 seconds).phc2sys_pollโ specify the polling interval used byphc2systo read a PTP clock synchronized byptp4land update theSOCK/SHMsample forchronyd/ntpd. it's specified as a power of two in seconds. the default value is0(1 second).delayโ specify the maximum assumed roundtrip delay to the primary source of the time in this PTP domain. this value is included in the distance used bychronydin the source selection algorithm to detect falsetickers and assign weights for source combining. the default value is1e-4(100 microseconds). withntpd, thetos mindistcommand can be used to set a limit with similar purpose globally for all time sources. ๐งntp_optionsโ specify extra options that should be added for this source to therefclockorserverdirectives in the configuration file of the selected NTP implementation. no extra options are added by default. โptp4l_optionโ specify an extraptp4loption specific to this PTP domain that should be added to the configuration files generated forptp4l. this option may be used multiple times in oneptp_domainsection. ๐
๐ [chronyd] ๐
pathโ specify the path to thechronydbinary. the default value ischronydto search for the binary inPATH. ๐optionsโ specify extra options that should be added to thechronydcommand line. no extra options are added by default. โ
๐ [chrony.conf] ๐
settings specified in this section are copied directly to the configuration file generated for chronyd. if this section is not present in the timemaster configuration file, the following setting will be added:
makestep 1 3
this configures chronyd to step the system clock in the first three updates if the offset is larger than 1 second. โจ
โญ [ntpd] โญ
pathโ specify the path to thentpdbinary. the default value isntpdto search for the binary inPATH. ๐optionsโ specify extra options that should be added to thentpdcommand line. no extra options are added by default. โ
๐ [ntp.conf] ๐
settings specified in this section are copied directly to the configuration file generated for ntpd. if this section is not present in the timemaster configuration file, the following settings will be added:
restrict default nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1
this configures ntpd to use safe default restrictions. safety first, bestie. ๐ก๏ธ
๐ซถ [phc2sys] ๐ซถ
pathโ specify the path to thephc2sysbinary. the default value isphc2systo search for the binary inPATH. ๐optionsโ specify extra options that should be added to allphc2syscommand lines. by default,-l 5is added to the command lines. โ
๐ [ptp4l] ๐
pathโ specify the path to theptp4lbinary. the default value isptp4lto search for the binary inPATH. ๐optionsโ specify extra options that should be added to allptp4lcommand lines. by default,-l 5is added to the command lines. โ
๐ง [ptp4l.conf] ๐ง
settings specified in this section are copied directly to the global section of the configuration files generated for all ptp4l instances. there is no default content of this section. ๐ญ
other sections (e.g. [unicast_master_table]) may be specified here, but lines beginning with the bracket need to be prefixed with the > character to prevent timemaster from parsing it as a beginning of another section. iykyk โ that little > is the whole trick. ๐คซ
๐ NOTES ๐
okay bestie, real talk: for best accuracy, chronyd is usually preferred over ntpd, and it also synchronizes the system clock faster. but both NTP implementations have some limitations you gotta consider before picking one for a given timemaster config. no cap. ๐
The chronyd limitations are:
- In version
1.31and older, the maximum number of reference clocks used at the same time is8. This limits the number of PHCs and interfaces using SW time stamping that can be used for PTP. ๐ญ - Using polling intervals (
minpoll,maxpoll,ntp_polloptions) shorter than2(4seconds) is not recommended with versions before1.30. With1.30and later values of0or1can be used for NTP sources and negative values for PTP sources (ntp_poll) to specify a subsecond interval. โจ
The ntpd limitations are:
- In versions before
4.2.8p1, only the first two shared-memory segments created by thentpdSHM refclock driver have owner-only access. Other segments are created with world access, which allows any user on the system to write to the segments and disrupt or take control over the synchronization of the clock. In4.2.8p1the access was made configurable with themodeoption, which is set bytimemasterfor owner-ownly access. ๐จ - The shortest polling interval for all sources is
3(8seconds). - Nanosecond resolution in the SHM refclock driver is supported in version
4.2.7p303and later, older versions have only microsecond resolution. ๐ฐ๏ธ
๐ EXAMPLES ๐
A minimal configuration file using one NTP source and two PTP sources would be:
[ntp_server 10.1.1.1]
[ptp_domain 0]
interfaces eth0
[ptp_domain 1]
interfaces eth1
A more complex example using all timemaster options would be:
[ntp_server 10.1.1.1]
minpoll 3
maxpoll 4
iburst 1
ntp_options key 12
[ptp_domain 0]
interfaces eth0 eth1
ntp_poll 0
phc2sys_poll -2
delay 10e-6
ntp_options prefer
ptp4l_option clock_servo linreg
ptp4l_option delay_mechanism P2P
[timemaster]
ntp_program chronyd
rundir /var/run/timemaster
first_shm_segment 1
restart_processes 0
use_vclocks 0
[chronyd]
path /usr/sbin/chronyd
options
[chrony.conf]
makestep 1 3
logchange 0.5
rtcsync
driftfile /var/lib/chrony/drift
[ntpd]
path /usr/sbin/ntpd
options -u ntp:ntp
[ntp.conf]
restrict default nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1
driftfile /var/lib/ntp/drift
[phc2sys]
path /usr/sbin/phc2sys
options -l 5
[ptp4l]
path /usr/sbin/ptp4l
options
[ptp4l.conf]
logging_level 5
๐ SEE ALSO ๐
chronyd(8), ntpd(8), phc2sys(8), ptp4l(8)
and that's the whole vibe, bestie ๐ this page came from linuxptp, dated January 2021, for TIMEMASTER(8). go forth and sync those clocks like the main character you are. ๐โจ
๐ฆ where this page comes from
- arch rolling: linuxptp 4.4-2 ยท GPL-2.0-or-later
- centos-stream 10: linuxptp 4.4-9.el10 ยท GPL-2.0-or-later
- debian trixie: linuxptp 4.2-1 ยท GPL-2.0-or-later
- fedora 43: linuxptp 4.4-7.fc43 ยท GPL-2.0-or-later
- fedora 44: linuxptp 4.4-10.fc44 ยท GPL-2.0-or-later
- nixpkgs unstable: linuxptp 4.4
- opensuse-leap 16.0: linuxptp 4.4-160000.3.1 ยท GPL-2.0-or-later
- opensuse-leap 16.0: linuxptp 4.4-160000.3.1 ยท GPL-2.0-or-later
- opensuse-leap 16.0: linuxptp 4.4-160000.3.1 ยท GPL-2.0-or-later
- opensuse-leap 16.0: linuxptp 4.4-160000.3.1 ยท GPL-2.0-or-later
- ubuntu noble: linuxptp 4.0-1ubuntu1 ยท GPL-2.0-or-later
- ubuntu noble: linuxptp 4.0-1ubuntu1.1 ยท GPL-2.0-or-later
- ubuntu questing: linuxptp 4.2-1ubuntu2
- ubuntu resolute: linuxptp 4.4-0ubuntu1 ยท GPL-2.0-or-later
- ubuntu stonking: linuxptp 4.4-0ubuntu1 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms