|
SatCat5
|
Timestamps and metadata for a two-way time-transfer handshake.
The Precision Time Protocol (PTP / IEEE-1588-2019) defines several variations on the two-way time-transfer handshake. The process is illustrated in Section 11.3 Figure 41 (leader-follower) and in Section 11.4 Figure 42 (peer-to-peer). In both cases, each complete measurement requires four timestamps:
The Measurement class holds the four timestamps of a given measurement, plus additional metadata such as sequence-ID used to match packets to a given exchange.
Definition at line 37 of file ptp_measurement.h.
#include <ptp_measurement.h>
Public Member Functions | |
| Measurement (const Measurement &t)=default | |
| Measurement & | operator= (const Measurement &t)=default |
| bool | done () const |
| Is this measurement completed? (i.e., T1/T2/T3/T4 all known) | |
| void | log_to (satcat5::log::LogBuffer &wr) const |
| Write all four timestamps to the log. | |
| bool | match (const satcat5::ptp::Header &hdr, const satcat5::ptp::PortId &port) const |
| Check if an incoming message matches this exchange. More... | |
| satcat5::ptp::Time | mean_path_delay () const |
| Calculate PTP "meanPathDelay". More... | |
| satcat5::ptp::Time | mean_link_delay () const |
| Calculate PTP "meanLinkDelay". More... | |
| satcat5::ptp::Time | offset_from_master () const |
| Calculate PTP "offsetFromMaster". More... | |
| void | reset (const satcat5::ptp::Header &hdr) |
| Reset this data structure for immediate reuse. More... | |
Public Attributes | |
| satcat5::ptp::Header | ref |
| Reference header is copied from the initiating PTP message (i.e., SYNC or PDELAY_REQ) and used to match later messages. | |
| satcat5::ptp::Time | t1 |
| Timestamp T1 (A to B / Tx) | |
| satcat5::ptp::Time | t2 |
| Timestamp T2 (A to B / Rx) | |
| satcat5::ptp::Time | t3 |
| Timestamp T3 (B to A / Tx) | |
| satcat5::ptp::Time | t4 |
| Timestamp T4 (B to A / Rx) | |
| bool Measurement::match | ( | const satcat5::ptp::Header & | hdr, |
| const satcat5::ptp::PortId & | port | ||
| ) | const |
Check if an incoming message matches this exchange.
(i.e., Matching sequence-ID, sdo_id, etc.)
Definition at line 32 of file ptp_measurement.cc.
| Time Measurement::mean_link_delay | ( | ) | const |
Calculate PTP "meanLinkDelay".
Calculate derived clock parameters using the recommended methods defined in IEEE 1588-2019 Section 11.
Definition at line 46 of file ptp_measurement.cc.
| Time Measurement::mean_path_delay | ( | ) | const |
Calculate PTP "meanPathDelay".
Calculate derived clock parameters using the recommended methods defined in IEEE 1588-2019 Section 11.
Definition at line 41 of file ptp_measurement.cc.
| Time Measurement::offset_from_master | ( | ) | const |
Calculate PTP "offsetFromMaster".
Calculate derived clock parameters using the recommended methods defined in IEEE 1588-2019 Section 11.
Definition at line 51 of file ptp_measurement.cc.
| void Measurement::reset | ( | const satcat5::ptp::Header & | hdr | ) |
Reset this data structure for immediate reuse.
Reset (overwrite) the current measurement state, saving the header of the initiating SYNC or PDELAY_REQ message.
Definition at line 56 of file ptp_measurement.cc.