summaryrefslogtreecommitdiffstats
path: root/darwin
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 /darwin
parentf80509358954a39234b136466c4c6a77187744e9 (diff)
Update battery API to use NAN on error
Diffstat (limited to 'darwin')
-rw-r--r--darwin/Battery.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/darwin/Battery.c b/darwin/Battery.c
index d52a5954..51d49c6d 100644
--- a/darwin/Battery.c
+++ b/darwin/Battery.c
@@ -1,6 +1,8 @@
#include "BatteryMeter.h"
+#include <math.h>
+
#include <CoreFoundation/CoreFoundation.h>
#include <CoreFoundation/CFString.h>
#include <IOKit/ps/IOPowerSources.h>
@@ -9,7 +11,7 @@
void Battery_getData(double* level, ACPresence* isOnAC) {
CFTypeRef power_sources = IOPSCopyPowerSourcesInfo();
- *level = -1;
+ *level = NAN;
*isOnAC = AC_ERROR;
if(NULL == power_sources) {

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