JitterCorrection.h 797 B

123456789101112131415161718192021222324252627
  1. /*
  2. timestamp jitter correction class
  3. */
  4. #pragma once
  5. class JitterCorrection {
  6. public:
  7. // constructor
  8. JitterCorrection(uint16_t max_lag_ms=500, uint16_t convergence_loops=100);
  9. // correct an offboard timestamp to a jitter-free local
  10. // timestamp. See JitterCorrection.cpp for details
  11. uint64_t correct_offboard_timestamp_usec(uint64_t offboard_usec, uint64_t local_usec);
  12. // correct an offboard timestamp to a jitter-free local
  13. // timestamp. See JitterCorrection.cpp for details
  14. uint32_t correct_offboard_timestamp_msec(uint32_t offboard_ms, uint32_t local_ms);
  15. private:
  16. const uint16_t max_lag_ms;
  17. const uint16_t convergence_loops;
  18. int64_t link_offset_usec;
  19. int64_t min_sample_us;
  20. bool initialised;
  21. uint16_t min_sample_counter;
  22. };