Browse Source

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@
OPENBSD_5_9
millert 9 years ago
parent
commit
52caae6b33
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/usr.sbin/ntpd/ntp.c

+ 2
- 2
src/usr.sbin/ntpd/ntp.c View File

@ -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 <henning@openbsd.org>
@ -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();
}


Loading…
Cancel
Save