pdelay

package
v0.0.0-...-c84c324 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package pdelay implements PTP Peer Delay measurement for in-rack linearizability checks.

The peer delay mechanism uses Pdelay_Req, Pdelay_Resp, and Pdelay_Resp_Follow_Up messages to measure the path delay between two PTP nodes. This is particularly useful for measuring time differences between hosts in the same rack where symmetric paths can be guaranteed.

Timestamp exchange:

  • T1: Pdelay_Req departure time (requester)
  • T2: Pdelay_Req arrival time (responder)
  • T3: Pdelay_Resp departure time (responder)
  • T4: Pdelay_Resp arrival time (requester)

CorrectionFields compensate for residence time in Transparent Clocks:

  • CFReq: from PDelay_Resp (request path: requester→responder)
  • CFResp: from PDelay_Resp_Follow_Up (response path: responder→requester)

Path delay = ((T2 - T1 - CFReq) + (T4 - T3 - CFResp)) / 2 Offset = ((T2 - T1 - CFReq) - (T4 - T3 - CFResp)) / 2

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	// Responder is the target of the measurement (remote host)
	Responder netip.Addr
	// T1 is the Pdelay_Req departure time at requester
	T1 time.Time
	// T2 is the Pdelay_Req arrival time at responder
	T2 time.Time
	// T3 is the Pdelay_Resp departure time at responder
	T3 time.Time
	// T4 is the Pdelay_Resp arrival time at requester
	T4 time.Time
	// CorrectionFieldReq is the CF from PDelay_Resp (request path: requester→responder)
	CorrectionFieldReq time.Duration
	// CorrectionFieldResp is the CF from PDelay_Resp_Follow_Up (response path: responder→requester)
	CorrectionFieldResp time.Duration
	// Timestamp is when this measurement was taken
	Timestamp time.Time
	// Error contains any error that occurred during measurement
	Error error
}

Result represents the result of a peer delay measurement

func (*Result) Offset

func (r *Result) Offset() time.Duration

Offset calculates the time offset between requester and responder Offset = ((T2 - T1 - CFReq) - (T4 - T3 - CFResp)) / 2 The CorrectionFields compensate for residence time in Transparent Clocks

func (*Result) PathDelay

func (r *Result) PathDelay() time.Duration

PathDelay calculates the mean path delay between requester and responder PathDelay = ((T2 - T1 - CFReq) + (T4 - T3 - CFResp)) / 2 The CorrectionFields compensate for residence time in Transparent Clocks

func (*Result) Valid

func (r *Result) Valid() bool

Valid returns true if all timestamps are set

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL