summaryrefslogtreecommitdiffstats
path: root/openbsd
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2020-09-07 11:52:42 +0200
committercgzones <cgzones@googlemail.com>2020-09-24 18:06:36 +0200
commit47e2cefe02dffe00369e5630eb1e3f54174f20af (patch)
treef517c3f21b226cda4520ed27686af7130f2d0531 /openbsd
parentf80509358954a39234b136466c4c6a77187744e9 (diff)
Update battery API to use NAN on error
Diffstat (limited to 'openbsd')
-rw-r--r--openbsd/Battery.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/openbsd/Battery.c b/openbsd/Battery.c
index c215e418..66e4b631 100644
--- a/openbsd/Battery.c
+++ b/openbsd/Battery.c
@@ -10,6 +10,7 @@ in the source distribution for its full text.
#include <sys/sysctl.h>
#include <sys/sensors.h>
#include <errno.h>
+#include <math.h>
#include <string.h>
static bool findDevice(const char* name, int* mib, struct sensordev* snsrdev, size_t* sdlen) {
@@ -36,7 +37,7 @@ void Battery_getData(double* level, ACPresence* isOnAC) {
bool found = findDevice("acpibat0", mib, &snsrdev, &sdlen);
- *level = -1;
+ *level = NAN;
if (found) {
/* last full capacity */
mib[3] = 7;

© 2014-2024 Faster IT GmbH | imprint | privacy policy