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

Function validatePPSEvent

phc/pps_source.go:219–228  ·  view source on GitHub ↗
(eventTimestamp time.Time, dstDevice DeviceController)

Source from the content-addressed store, hash-verified

217}
218
219func validatePPSEvent(eventTimestamp time.Time, dstDevice DeviceController) error {
220 dstTs, err := dstDevice.Time()
221 if err != nil {
222 return fmt.Errorf("error getting dst timestamp")
223 }
224 if dstTs.Sub(eventTimestamp).Abs().Seconds() > 1 {
225 return fmt.Errorf("stale (over 1s) event: PPS event was %+v before current time on dst %+v", dstTs.Sub(eventTimestamp), dstTs.UnixNano())
226 }
227 return nil
228}
229
230// PPSClockSync adjusts the frequency of the destination device based on the PPS from the ppsSource
231func PPSClockSync(pi ServoController, srcTimestamp time.Time, dstEventTimestamp time.Time, dstDevice DeviceController) error {

Callers 1

PPSClockSyncFunction · 0.85

Calls 3

SecondsMethod · 0.80
TimeMethod · 0.65
SubMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…