PHC_CTL(8)
πΈ NAME πΈ
ok so phc_ctl β it's the girl who directly controls a PHC device clock π
no middleman, no vibes, just straight-up hands-on clock management. This is the phc_ctl manual page, section 8, and she's here to spill everything.
β¨ SYNOPSIS β¨
phc_ctl [ options ] <device> [ commands ]
π¦ DESCRIPTION π¦
so like, phc_ctl is a program that can be used to directly control a PHC clock device. bestie, real talk: it's typically used for debugging purposes, and it has little use for general control of the device. if you actually want to generally control PHC clock devices, phc2sys(8) should be preferred. like, that's the main character for that job, no cap. π
<device> may be either:
CLOCK_REALTIME- any
/dev/ptpXdevice - any ethernet device which supports ethtool's
get_ts_infoioctl
so many options, we love a flexible queen π
π OPTIONS π
-lprint-level β set the maximum syslog level of messages which should be printed or sent to the system logger. the default is6(LOG_INFO). β¨-qβ do not send messages to syslog. by default messages will be sent. π-Qβ do not print messages to standard output. by default messages will be printed. π-hβ display a help message. the classic. π«Ά-vβ prints the software version and exits. bye bestie π
π COMMANDS π
so phc_ctl is controlled by passing commands which take either an optional or required parameter. the commands (outlined below) will control aspects of the PHC clock device. these commands may be useful for inspecting or debugging the PHC driver, but β and this is important, bestie β they may have adverse side effects on running instances of ptp4l(8) or phc2sys(8). π so like, be careful out there.
β οΈ real talk: these commands can mess with runningptp4l(8) orphc2sys(8) instances. know before you go, fr fr.
setseconds β set the PHC clock time to the value specified in seconds. defaults to readingCLOCK_REALTIMEif no value is provided. iconic default behavior honestly β¨getβ get the current time of the PHC clock device. just a lil peek, she's nosy πΈadjseconds β adjust the PHC clock by an amount of seconds provided. this argument is required. no argument, no service π ββοΈfreqppb β adjust the frequency of the PHC clock by the specified parts per billion. if no argument is provided, it will attempt to read the current frequency and report it. lowkey a vibe check on the frequency πphaseseconds β pass an amount in seconds to the PHC clock's phase control keyword. this argument is required. periodt.cmpβ compare the PHC clock device toCLOCK_REALTIME, using the best method available. the way it just picks the best methodβ¦ queen behavior πcapsβ display the device capabilities. this is the default command if no commands are provided. the fallback fave πwaitseconds β sleep the process for the specified period of time, waking up and resuming afterwards. this command may be useful for sanity checking whether the PHC clock is running as expected. π€
the arguments specified in seconds are read as double precision floating point values, and will scale to nanoseconds. this means providing a value of 5.5 means 5 and one half seconds. this allows specifying fairly precise values for time. so precise. so slay. β¨
π EXAMPLES π
Read the current clock time from the device
phc_ctl /dev/ptp0 get
Set the PHC clock time to CLOCK_REALTIME
phc_ctl /dev/ptp0 set
Set PHC clock time to 0 (seconds since Epoch)
phc_ctl /dev/ptp0 set 0.0
Quickly sanity check frequency slewing by setting slewing frequency by positive 10%, resetting clock to 0.0 time, waiting for 10 seconds, and then reading time. the time read back should be (roughly) 11 seconds, since the clock was slewed 10% faster.
phc_ctl /dev/ptp0 freq 100000000 set 0.0 wait 10.0 get
likeβ¦ the math is mathing and the clock is clocking π₯
π SEE ALSO π
ptp4l(8) phc2sys(8)
ok that's the whole page bestie, go forth and control those PHC clocks responsibly π¦ this lil masterpiece comes to you from linuxptp, dated June 2014, and honestly? she ate. π β¨π
π¦ 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
- centos-stream 9: linuxptp 4.4-6.el9 Β· 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 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