battery: fixed remaining time on connected AC

when an AC is connected apm_info shows a non-valid value for remaining
minutes. it was decided that in that case the function should return an
empty string.
This commit is contained in:
Tobias Tschinkowitz 2018-05-18 16:33:51 +02:00 committed by Aaron Marcher
parent 2604f25b16
commit 367f8a8c44

View file

@ -121,8 +121,12 @@
struct apm_power_info apm_info; struct apm_power_info apm_info;
if (load_apm_power_info(&apm_info)) { if (load_apm_power_info(&apm_info)) {
if (apm_info.ac_state != APM_AC_ON) {
return bprintf("%u:%02u", apm_info.minutes_left / 60, return bprintf("%u:%02u", apm_info.minutes_left / 60,
apm_info.minutes_left % 60); apm_info.minutes_left % 60);
} else {
return strdup("");
}
} }
return NULL; return NULL;