mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-05 13:45:06 -05:00
ntp: add special value to experimental root delay/disp
The maximum value of the new 32-bit fields is slightly less than 16, which can cause the NTP test #7 to pass for a server which has a zero root delay but maximum root dispersion. Interpret the maximum value as the maximum value of the original 32-bit fields (~65536.0 seconds) for better compatibility with NTPv4.
This commit is contained in:
8
util.c
8
util.c
@@ -640,7 +640,13 @@ UTI_DoubleToNtp32(double x)
|
||||
double
|
||||
UTI_Ntp32f28ToDouble(NTP_int32 x)
|
||||
{
|
||||
return ntohl(x) / (double)(1U << 28);
|
||||
uint32_t r = ntohl(x);
|
||||
|
||||
/* Maximum value is special */
|
||||
if (r == 0xffffffff)
|
||||
return MAX_NTP_INT32;
|
||||
|
||||
return r / (double)(1U << 28);
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
Reference in New Issue
Block a user