(t *testing.T)
| 39 | } |
| 40 | |
| 41 | func TestSysoffBestSample(t *testing.T) { |
| 42 | extended := &PTPSysOffsetExtended{ |
| 43 | Samples: 3, |
| 44 | Ts: [unix.PTP_MAX_SAMPLES][3]PtpClockTime{ |
| 45 | {{Sec: 1667818190, Nsec: 552297411}, {Sec: 1667818153, Nsec: 552297462}, {Sec: 1667818190, Nsec: 552297522}}, |
| 46 | {{Sec: 1667818190, Nsec: 552297533}, {Sec: 1667818153, Nsec: 552297582}, {Sec: 1667818190, Nsec: 552297622}}, |
| 47 | {{Sec: 1667818190, Nsec: 552297644}, {Sec: 1667818153, Nsec: 552297661}, {Sec: 1667818190, Nsec: 552297722}}, |
| 48 | }, |
| 49 | ClockID: unix.CLOCK_MONOTONIC_RAW, |
| 50 | } |
| 51 | got := extended.BestSample() |
| 52 | want := SysoffResult{ |
| 53 | SysTime: time.Unix(0, 1667818190552297683), |
| 54 | PHCTime: time.Unix(0, 1667818153552297661), |
| 55 | Delay: time.Duration(78), |
| 56 | Offset: time.Duration(37000000022), |
| 57 | SysClockID: unix.CLOCK_MONOTONIC_RAW, |
| 58 | } |
| 59 | require.Equal(t, want, got) |
| 60 | } |
| 61 | |
| 62 | func TestSysoffFromExtendedTS(t *testing.T) { |
| 63 | extendedTS := [3]PtpClockTime{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…