[hackers] [slstatus] battery_remaining: Change float to double || Aaron Marcher
commit a546d4b585234f66b82e048c2d7cb228b9e7fea4
Author: Aaron Marcher <me_AT_drkhsh.at>
AuthorDate: Mon May 21 00:41:03 2018 +0200
Commit: Aaron Marcher <me_AT_drkhsh.at>
CommitDate: Mon May 21 00:41:03 2018 +0200
battery_remaining: Change float to double
diff --git a/components/battery.c b/components/battery.c
index 6105a37..fa525be 100644
--- a/components/battery.c
+++ b/components/battery.c
_AT_@ -83,7 +83,7 @@
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),
_AT_@ -107,9 +107,9 @@
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);
}
Received on Mon May 21 2018 - 00:42:24 CEST
This archive was generated by hypermail 2.3.0
: Mon May 21 2018 - 00:48:29 CEST