From: Pierre Fersing Date: Tue, 20 Oct 2015 09:27:41 +0000 (+0200) Subject: Fix NTP kerninfo offset/estimated error scaling X-Git-Tag: collectd-5.5.1~40^2~19 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=53438c510bc06ca4ca0e12e41dc8c77c8dde5345;hp=c334d63f821c5390af86b90c30e5334b2e97c6ad;p=collectd.git Fix NTP kerninfo offset/estimated error scaling --- diff --git a/src/ntpd.c b/src/ntpd.c index 540eb788..8e00734c 100644 --- a/src/ntpd.c +++ b/src/ntpd.c @@ -901,6 +901,7 @@ static int ntpd_read (void) int status; int i; + double tscale = 1e-6; ik = NULL; ik_num = 0; @@ -929,13 +930,13 @@ static int ntpd_read (void) " pll offset = %.8f\n" " pll frequency = %.8f\n" /* drift compensation */ " est error = %.8f\n", - ntpd_read_fp (ik->offset), + (int32_t)ntohl(ik->offset) * tscale, ntpd_read_fp (ik->freq), - ntpd_read_fp (ik->esterror)); + (u_long)ntohl(ik->esterror) * 1e-6); ntpd_submit ("frequency_offset", "loop", ntpd_read_fp (ik->freq)); - ntpd_submit ("time_offset", "loop", ntpd_read_fp (ik->offset)); - ntpd_submit ("time_offset", "error", ntpd_read_fp (ik->esterror)); + ntpd_submit ("time_offset", "loop", (int32_t)ntohl(ik->offset) * tscale); + ntpd_submit ("time_offset", "error", (u_long)ntohl(ik->esterror) * 1e-6); free (ik); ik = NULL;