diff options
author | drkhsh <me@drkhsh.at> | 2022-10-27 23:47:01 +0200 |
---|---|---|
committer | drkhsh <me@drkhsh.at> | 2022-10-28 01:03:20 +0200 |
commit | df79bf0985d2963a92add31d286b2b97962c6a22 (patch) | |
tree | 77b5e22e41c148e5f6ff8d5ea857d10328267a24 /components/battery.c | |
parent | 95c0f2015d2d1b2bb396ede2dddb34ae787d1351 (diff) |
battery: Refactor remaining on OpenBSD
Fixes up overly complicated line, by splitting up logic
Diffstat (limited to 'components/battery.c')
-rw-r--r-- | components/battery.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/components/battery.c b/components/battery.c index 0fe70ff..ee2fe71 100644 --- a/components/battery.c +++ b/components/battery.c @@ -182,12 +182,13 @@ battery_remaining(const char *unused) { struct apm_power_info apm_info; + unsigned int h, m; if (load_apm_power_info(&apm_info)) { if (apm_info.ac_state != APM_AC_ON) { - return bprintf("%uh %02um", - apm_info.minutes_left / 60, - apm_info.minutes_left % 60); + h = apm_info.minutes_left / 60; + m = apm_info.minutes_left % 60; + return bprintf("%uh %02um", h, m); } else { return ""; } |