(eventTimestamp time.Time, dstDevice DeviceController)
| 217 | } |
| 218 | |
| 219 | func 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 |
| 231 | func PPSClockSync(pi ServoController, srcTimestamp time.Time, dstEventTimestamp time.Time, dstDevice DeviceController) error { |
no test coverage detected
searching dependent graphs…