SatCat5
satcat5::ptp::Measurement Struct Reference

Detailed Description

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:

  • t1 = Tx time of 1st message (A to B, measured in A's clock)
  • t2 = Rx time of 1st message (A to B, measured in B's clock)
  • t3 = Tx time of 2nd message (B to A, measured in B's clock)
  • t4 = Rx time of 2nd message (B to A, measured in A's clock)

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.

See also
MeasurementCache

Definition at line 37 of file ptp_measurement.h.

#include <ptp_measurement.h>

Collaboration diagram for satcat5::ptp::Measurement:
[legend]

Public Member Functions

 Measurement (const Measurement &t)=default
 
Measurementoperator= (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)
 

Member Function Documentation

◆ match()

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.

◆ mean_link_delay()

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.

◆ mean_path_delay()

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.

◆ offset_from_master()

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.

◆ reset()

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.


The documentation for this struct was generated from the following files: