Xinqi Bao's Git
projects
/
slstatus.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
ram: Use POSIX types
[slstatus.git]
/
components
/
battery.c
diff --git
a/components/battery.c
b/components/battery.c
index
fa525be
..
99e09d5
100644
(file)
--- a/
components/battery.c
+++ b/
components/battery.c
@@
-1,5
+1,4
@@
/* See LICENSE file for copyright and license details. */
/* See LICENSE file for copyright and license details. */
-#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <string.h>
@@
-107,6
+106,10
@@
return NULL;
}
return NULL;
}
+ if (current_now == 0) {
+ return NULL;
+ }
+
timeleft = (double)charge_now / (double)current_now;
h = timeleft;
m = (timeleft - (double)h) * 60;
timeleft = (double)charge_now / (double)current_now;
h = timeleft;
m = (timeleft - (double)h) * 60;