Crate ptp_sync

Source
Expand description

A (probably only Linux-compatible) crate that provides ClockSyncer, which can synchronize on-demand the system-wide real-time (i.e., wall-clock time) clock using a specified PTP clock as the source of truth.

It was originally developed to be used with KVM’s paravirtualized PTP clock as source.

Structs§

ClockSyncer
Stores the state of the source PTP clock (i.e., an open file descriptor to it), and provides ClockSyncer::sync to set on-demand the system-wide real-time (i.e., wall-clock time) clock to the time of that source PTP clock.

Enums§

Error

Constants§

PTP_CLOCK_NAME_LEN
The maximum length of a PTP clock’s name in bytes, based on Linux source code, which equals to 32 bytes.

Functions§

find_ptp_kvm
Attempt to find the path to a device node (under /dev/) that corresponds to the KVM PTP clock.
procfs_find_ptp_major
Search procfs(5) for the major number assigned to the PTP driver.
verify_ptp_dev
Returns true if the provided (absolute) path refers to a PTP clock device node (typically under /dev/), or false otherwise.