commit 3b86e4b5efd0f6759b2634b607e74b938af30a60
Author:     drkhsh <[email protected]>
AuthorDate: Thu Oct 27 23:47:01 2022 +0200
Commit:     drkhsh <[email protected]>
CommitDate: Fri Oct 28 01:03:20 2022 +0200

    battery: Refactor remaining on OpenBSD
    
    Fixes up overly complicated line, by splitting up logic

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 "";
                        }

Reply via email to