mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 18:05:06 -05:00
hwclock: fix conversion of HW timestamps
Fix a sign error in conversion of HW time to local time, which caused the jitter to be amplified instead of reduced. NTP with HW timestamping should now be more stable and able to ignore occasionally delayed readings of PHC.
This commit is contained in:
@@ -198,7 +198,7 @@ HCL_CookTime(HCL_Instance clock, struct timespec *raw, struct timespec *cooked,
|
||||
return 0;
|
||||
|
||||
elapsed = UTI_DiffTimespecsToDouble(raw, &clock->hw_ref);
|
||||
offset = clock->offset + elapsed / clock->frequency;
|
||||
offset = elapsed / clock->frequency - clock->offset;
|
||||
UTI_AddDoubleToTimespec(&clock->local_ref, offset, cooked);
|
||||
|
||||
/* Fow now, just return the error of the last sample */
|
||||
|
||||
Reference in New Issue
Block a user