| 16 | /// 算法:基于最小二乘法的线性回归 (Linear Regression on Sliding Window) |
| 17 | #[derive(Debug)] |
| 18 | pub struct ClockSynchronizer { |
| 19 | /// 滑动窗口大小 (例如最近 30 帧) |
| 20 | window_size: usize, |
| 21 | /// 历史数据点 (HW_Timestamp, System_Arrival_Time) |
| 22 | history: VecDeque<(u64, Instant)>, |
| 23 | /// 是否已初始化基准 |
| 24 | #[allow(dead_code)] |
| 25 | baseline_established: bool, |
| 26 | /// 估算的斜率 (Drift Rate) |
| 27 | estimated_slope: f64, |
| 28 | /// 估算的截距 (Offset) |
| 29 | estimated_offset: f64, |
| 30 | } |
| 31 | |
| 32 | impl ClockSynchronizer { |
| 33 | pub fn new(window_size: usize) -> Self { |
nothing calls this directly
no outgoing calls
no test coverage detected