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

Function TestSysoffFromPrecise

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

Source from the content-addressed store, hash-verified

76}
77
78func TestSysoffFromPrecise(t *testing.T) {
79 preciseTs := &PTPSysOffsetPrecise{
80 Realtime: PtpClockTime{Sec: 1667818190, Nsec: 552297411},
81 Device: PtpClockTime{Sec: 1667818153, Nsec: 552297462},
82 Monoraw: PtpClockTime{Sec: 1667818190, Nsec: 552297522},
83 }
84 sysoff := SysoffFromPrecise(preciseTs)
85 want := SysoffResult{
86 SysTime: time.Unix(1667818190, 552297522),
87 PHCTime: time.Unix(1667818153, 552297462),
88 SysClockID: unix.CLOCK_MONOTONIC_RAW,
89 Delay: 0,
90 Offset: 37000000060,
91 }
92 require.Equal(t, want, sysoff)
93}
94
95func TestOffsetBetweenPreciseReadings(t *testing.T) {
96 preciseA := &PTPSysOffsetPrecise{

Callers

nothing calls this directly

Calls 2

SysoffFromPreciseFunction · 0.85
UnixMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…