battery_remaining: Change float to double
Aaron Marcher me@drkhsh.at
Mon, 21 May 2018 00:41:03 +0200
1 files changed,
3 insertions(+),
3 deletions(-)
jump to
M
components/battery.c
→
components/battery.c
@@ -83,7 +83,7 @@ const char *
battery_remaining(const char *bat) { int charge_now, current_now, m, h; - float timeleft; + double timeleft; char path[PATH_MAX], state[12]; if (esnprintf(path, sizeof(path),@@ -107,9 +107,9 @@ pscanf(path, "%d", ¤t_now) < 0) {
return NULL; } - timeleft = (float)charge_now / (float)current_now; + timeleft = (double)charge_now / (double)current_now; h = timeleft; - m = (timeleft - (float)h) * 60; + m = (timeleft - (double)h) * 60; return bprintf("%dh %dm", h, m); }