diff --git a/sources/main/battery.c b/sources/main/battery.c index 9cde435..ea90855 100644 --- a/sources/main/battery.c +++ b/sources/main/battery.c @@ -41,7 +41,7 @@ int main(int argc, char *const argv[]){ printf("Literally how could you pass an unspecified argument to this program"); } } - + FILE * fd_now = fopen(CHARGE_NOW_PATH, "r"); FILE * fd_full = fopen(CHARGE_FULL_PATH, "r"); @@ -72,15 +72,15 @@ int main(int argc, char *const argv[]){ } if(run_verbose){ - printf("Current charge: %d\n", c_now); - printf("Full charge: %d\n", c_full); + printf("Current charge: %d\n microampere-hours", c_now); + printf("Full charge: %d\n microampere-hours", c_full); } if(!run_terse) { printf("Battery percentage: "); } - float pct = ((float)c_now) / ((float)c_full); - printf("%f\n", pct); - + float frac = ((float)c_now) / ((float)c_full); + int pct = (int)(frac * 100); + printf("%d\n", pct); return 0; }