summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2004-04-11 20:02:01 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2004-04-11 20:02:01 +0000
commitf8066c5ca1f7b74ba960a0439ad8b32ae1d96d9e (patch)
treefa3b909186055c6d1e63440b10f4b7b357402e9b
parent4c672632fa53cd80739d997b20e5943ed067a976 (diff)
Fix accidental busy loop waiting for a second to pass. Also, rename
constants that defined a period of time. ok deraadt@ henning@
-rw-r--r--usr.sbin/sensorsd/sensorsd.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.sbin/sensorsd/sensorsd.c b/usr.sbin/sensorsd/sensorsd.c
index 30bf43566e4..a1b95001f74 100644
--- a/usr.sbin/sensorsd/sensorsd.c
+++ b/usr.sbin/sensorsd/sensorsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sensorsd.c,v 1.9 2004/03/15 15:53:19 henning Exp $ */
+/* $OpenBSD: sensorsd.c,v 1.10 2004/04/11 20:02:00 otto Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -32,8 +32,8 @@
#define RFBUFSIZ 28 /* buffer size for print_sensor */
#define RFBUFCNT 4 /* ring buffers */
-#define REPORT_FREQ 60 /* report every n seconds */
-#define CHECK_FREQ 60 /* check every n seconds */
+#define REPORT_PERIOD 60 /* report every n seconds */
+#define CHECK_PERIOD 60 /* check every n seconds */
int main(int, char *[]);
void check_sensors(void);
@@ -129,14 +129,14 @@ main(int argc, char *argv[])
watch_cnt);
reload = 0;
}
- if (next_check < time(NULL)) {
+ if (next_check <= time(NULL)) {
check_sensors();
- next_check = time(NULL) + CHECK_FREQ;
+ next_check = time(NULL) + CHECK_PERIOD;
}
- if (next_report < time(NULL)) {
+ if (next_report <= time(NULL)) {
report(last_report);
last_report = next_report;
- next_report = time(NULL) + REPORT_FREQ;
+ next_report = time(NULL) + REPORT_PERIOD;
}
if (next_report < next_check)
sleeptime = next_report - time(NULL);