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

Function TestOffsetBetweenPreciseReadings

phc/offset_test.go:95–108  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

93}
94
95func TestOffsetBetweenPreciseReadings(t *testing.T) {
96 preciseA := &PTPSysOffsetPrecise{
97 Realtime: PtpClockTime{Sec: 1667818190, Nsec: 552297411},
98 Device: PtpClockTime{Sec: 1667818153, Nsec: 552297462},
99 Monoraw: PtpClockTime{Sec: 1667818190, Nsec: 552297522},
100 }
101 preciseB := &PTPSysOffsetPrecise{
102 Realtime: PtpClockTime{Sec: 1667818190, Nsec: 552297666}, // 255ns later than A
103 Device: PtpClockTime{Sec: 1667818153, Nsec: 552297462},
104 Monoraw: PtpClockTime{Sec: 1667818190, Nsec: 552297777}, // 255ns later than A
105 }
106 offset := preciseB.Sub(preciseA)
107 require.Equal(t, time.Duration(-255), offset)
108}
109
110func TestOffsetBetweenExtendedReadings(t *testing.T) {
111 extendedA := &PTPSysOffsetExtended{

Callers

nothing calls this directly

Calls 2

SubMethod · 0.95
DurationMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…