const char *
battery_remaining(const char *bat)
{
- uint64_t charge_now, current_now, m, h;
+ uintmax_t charge_now, current_now, m, h;
double timeleft;
char path[PATH_MAX], state[12];
if (!pick(bat, "/sys/class/power_supply/%s/charge_now",
"/sys/class/power_supply/%s/energy_now",
path, sizeof(path)) ||
- pscanf(path, "%" PRIu64, &charge_now) < 0) {
+ pscanf(path, "%" PRIuMAX, &charge_now) < 0) {
return NULL;
}
if (!pick(bat, "/sys/class/power_supply/%s/current_now",
"/sys/class/power_supply/%s/power_now", path,
sizeof(path)) ||
- pscanf(path, "%" PRIu64, ¤t_now) < 0) {
+ pscanf(path, "%" PRIuMAX, ¤t_now) < 0) {
return NULL;
}
h = timeleft;
m = (timeleft - (double)h) * 60;
- return bprintf("%" PRIu64 "h %" PRIu64 "m", h, m);
+ return bprintf("%" PRIuMAX "h %" PRIuMAX "m", h, m);
}
return "";