projects
/
suckless
/
slstatus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
21327e0
)
battery: Refactor remaining on OpenBSD
author
drkhsh
<me@drkhsh.at>
Thu, 27 Oct 2022 21:47:01 +0000
(23:47 +0200)
committer
drkhsh
<me@drkhsh.at>
Thu, 27 Oct 2022 23:03:20 +0000
(
01:03
+0200)
Fixes up overly complicated line, by splitting up logic
components/battery.c
patch
|
blob
|
history
diff --git
a/components/battery.c
b/components/battery.c
index 0fe70ff94b1b1f2cc138e4a90c227719b0c380d9..ee2fe714b1e800a12a74bcce54be6134fbbb256f 100644
(file)
--- 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 "";
}