Documentation
¶
Overview ¶
Package simpleclient provides very simplistic PTPv2 unicast client. It's not meant to be used in any project aiming to precisely sync time with it.
It's original purpose is to debug communication with PTP servers and illustrate protocol itself.
Index ¶
Constants ¶
View Source
const ( // HWTIMESTAMP is a hardware timestamp HWTIMESTAMP = ptp.HWTIMESTAMP // SWTIMESTAMP is a software timestmap SWTIMESTAMP = ptp.SWTIMESTAMP )
re-export timestamping
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a very simplified PTPv2 unicast client. Whenever it has all the data to calculate offset/delay/etc it will call provided callback function with `MeasurementResult`.
func New ¶
func New(cfg *Config, callback func(*MeasurementResult)) *Client
New initializes new PTPv2 unicast client
type Config ¶
type Config struct { // address of a server to talk to Address string // interface name that we'll use to send/receive packets Iface string // timeout of whole session Timeout time.Duration // for how long we'll request unicast transmission from server Duration time.Duration // what type of typestamping to use Timestamping string }
Config specifies Client run options
type MeasurementResult ¶
type MeasurementResult struct { Delay time.Duration Offset time.Duration ServerToClientDiff time.Duration ClientToServerDiff time.Duration Timestamp time.Time }
MeasurementResult is a single measured datapoint
Click to show internal directories.
Click to hide internal directories.