From 52caae6b33781d0bc8e079dde42f86d76907670f Mon Sep 17 00:00:00 2001 From: millert <> Date: Fri, 14 Aug 2015 02:00:18 +0000 Subject: [PATCH] When checking whether we should scan the sensors again use <= rather than < for the comparison. Otherwise, if we don't do enough work in the loop to advance the clock (for instance if the network is down) we may end up calling poll() multiple times with no timeout, racking up CPU time for no real reason. OK bcook@ --- src/usr.sbin/ntpd/ntp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/usr.sbin/ntpd/ntp.c b/src/usr.sbin/ntpd/ntp.c index b81dcea6..70be755e 100644 --- a/src/usr.sbin/ntpd/ntp.c +++ b/src/usr.sbin/ntpd/ntp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntp.c,v 1.134 2015/07/18 00:59:00 bcook Exp $ */ +/* $OpenBSD: ntp.c,v 1.135 2015/08/14 02:00:18 millert Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -315,7 +315,7 @@ ntp_main(int pipe_prnt[2], int fd_ctl, struct ntpd_conf *nconf, if (!TAILQ_EMPTY(&conf->ntp_conf_sensors)) { if (last_sensor_scan == 0 || - last_sensor_scan + SENSOR_SCAN_INTERVAL < getmonotime()) { + last_sensor_scan + SENSOR_SCAN_INTERVAL <= getmonotime()) { sensors_cnt = sensor_scan(); last_sensor_scan = getmonotime(); }