From: Neil Wilson Date: Thu, 23 Feb 2017 17:03:34 +0000 (+0000) Subject: ntpd: Correct loop offset and error calculation X-Git-Tag: collectd-5.6.3~9 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=c0760b142da433298ea090a5e4963adcc0192080;p=collectd.git ntpd: Correct loop offset and error calculation Stop the scaling calculation dropping the sign of the underlying value Fixes: #2188 --- 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"