summaryrefslogtreecommitdiffstats
path: root/dragonflybsd/Battery.c
diff options
context:
space:
mode:
Diffstat (limited to 'dragonflybsd/Battery.c')
-rw-r--r--dragonflybsd/Battery.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/dragonflybsd/Battery.c b/dragonflybsd/Battery.c
index f17efb5d..58960429 100644
--- a/dragonflybsd/Battery.c
+++ b/dragonflybsd/Battery.c
@@ -7,13 +7,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;