MCPcopy Create free account
hub / github.com/facebook/time / SysoffEstimateBasic

Function SysoffEstimateBasic

phc/offset.go:77–88  ·  view source on GitHub ↗

SysoffEstimateBasic logic based on calculate_offset from ptp4l phc_ctl.c

(ts1, rt, ts2 time.Time)

Source from the content-addressed store, hash-verified

75
76// SysoffFromPrecise returns SysoffResult from *PTPSysOffsetPrecise . Code based on sysoff_precise from ptp4l sysoff.c
77func SysRToffFromPrecise(pre *PTPSysOffsetPrecise) SysoffResult {
78 tp := time.Unix(pre.Device.Sec, int64(pre.Device.Nsec))
79 tr := time.Unix(pre.Realtime.Sec, int64(pre.Realtime.Nsec))
80 return SysoffResult{
81 SysTime: tr,
82 SysClockID: unix.CLOCK_REALTIME,
83 PHCTime: tp,
84 Delay: 0, // They are measured at the same time
85 Offset: tr.Sub(tp),
86 }
87}
88
89// SysoffEstimateBasic logic based on calculate_offset from ptp4l phc_ctl.c
90func SysoffEstimateBasic(ts1, rt, ts2 time.Time) SysoffResult {
91 interval := ts2.Sub(ts1)

Callers 2

TestSysoffEstimateBasicFunction · 0.85
TimeAndOffsetFromDeviceFunction · 0.85

Calls 1

SubMethod · 0.45

Tested by 1

TestSysoffEstimateBasicFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…