From c0760b142da433298ea090a5e4963adcc0192080 Mon Sep 17 00:00:00 2001 From: Neil Wilson Date: Thu, 23 Feb 2017 17:03:34 +0000 Subject: [PATCH] ntpd: Correct loop offset and error calculation Stop the scaling calculation dropping the sign of the underlying value Fixes: #2188 --- src/ntpd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ntpd.c b/src/ntpd.c index 1cb59dee..4ed4e7c8 100644 --- a/src/ntpd.c +++ b/src/ntpd.c @@ -855,9 +855,9 @@ static int ntpd_read(void) { } /* kerninfo -> estimated error */ - offset_loop = scale_loop * ((gauge_t)ntohl(ik->offset)); + offset_loop = (gauge_t)((int32_t)ntohl(ik->offset) * scale_loop); freq_loop = ntpd_read_fp(ik->freq); - offset_error = scale_error * ((gauge_t)ntohl(ik->esterror)); + offset_error = (gauge_t)((int32_t)ntohl(ik->esterror) * scale_error); DEBUG("info_kernel:\n" " pll offset = %.8g\n" -- 2.30.2