From 5d177fa2751b69710d11afd591c6590b2ff97370 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Mon, 25 Apr 2005 02:28:47 +0000 Subject: [PATCH] Don't issue a frequency correction if it is the same as the last frequency correction. --- usr.sbin/dntpd/client.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/usr.sbin/dntpd/client.c b/usr.sbin/dntpd/client.c index 3cf323bfd6..b5b98a924c 100644 --- a/usr.sbin/dntpd/client.c +++ b/usr.sbin/dntpd/client.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/usr.sbin/dntpd/client.c,v 1.5 2005/04/24 23:09:32 dillon Exp $ + * $DragonFly: src/usr.sbin/dntpd/client.c,v 1.6 2005/04/25 02:28:47 dillon Exp $ */ #include "defs.h" @@ -46,10 +46,13 @@ client_main(struct server_info **info_ary, int count) { struct server_info *best_off; struct server_info *best_freq; + double last_freq; double freq; double offset; int i; + last_freq = 0.0; + for (;;) { /* * Subtract the interval from poll_sleep and poll the client @@ -96,10 +99,15 @@ client_main(struct server_info **info_ary, int count) /* * Frequency correction (throw away minor freq adjusts from the - * offset code if we can't do a frequency correction here). + * offset code if we can't do a frequency correction here). Do + * not reissue if it hasn't changed from the last issued correction. */ if (best_freq) { - sysntp_correct_freq(best_freq->lin_cache_freq + freq); + freq += best_freq->lin_cache_freq; + if (last_freq != freq) { + sysntp_correct_freq(freq); + last_freq = freq; + } } /* -- 2.39.1