diff options
author | Benny Baumann <BenBE@geshi.org> | 2020-09-07 11:52:42 +0200 |
---|---|---|
committer | cgzones <cgzones@googlemail.com> | 2020-09-24 18:06:36 +0200 |
commit | 47e2cefe02dffe00369e5630eb1e3f54174f20af (patch) | |
tree | f517c3f21b226cda4520ed27686af7130f2d0531 /freebsd | |
parent | f80509358954a39234b136466c4c6a77187744e9 (diff) |
Update battery API to use NAN on error
Diffstat (limited to 'freebsd')
-rw-r--r-- | freebsd/Battery.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/freebsd/Battery.c b/freebsd/Battery.c index b8c5e312..009f7abe 100644 --- a/freebsd/Battery.c +++ b/freebsd/Battery.c @@ -6,13 +6,14 @@ in the source distribution for its full text. */ #include "BatteryMeter.h" +#include <math.h> #include <sys/sysctl.h> void Battery_getData(double* level, ACPresence* isOnAC) { int life; size_t life_len = sizeof(life); if (sysctlbyname("hw.acpi.battery.life", &life, &life_len, NULL, 0) == -1) - *level = -1; + *level = NAN; else *level = life; |