aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclsr <clsr@clsr.net>2022-02-17 20:04:01 +0000
committerclsr <clsr@clsr.net>2022-02-17 20:04:01 +0000
commit1f63241a82e0d8fce205dfbee3350f501a68b830 (patch)
treede2ea095c93842582d0bfdc6f1241fb991307f46
parent15f5a66646c6c4f9913aa98a64009f0958b0d935 (diff)
downloaddwmclock-1f63241a82e0d8fce205dfbee3350f501a68b830.tar.gz
dwmclock-1f63241a82e0d8fce205dfbee3350f501a68b830.zip
Fix power calculation using voltage and currentHEADv1.5.1master
-rw-r--r--dwmclock.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/dwmclock.c b/dwmclock.c
index ccafbe2..4ce8faf 100644
--- a/dwmclock.c
+++ b/dwmclock.c
@@ -142,7 +142,7 @@ int main(void)
#ifdef POWER_NOW
pcur = getnum(POWER_NOW);
#elif defined(CURRENT_NOW) && defined(VOLTAGE_NOW) /* POWER_NOW */
- pcur = getnum(CURRENT_NOW) * getnum(VOLTAGE_NOW) / 1000000;
+ pcur = (long long)getnum(CURRENT_NOW) * (long long)getnum(VOLTAGE_NOW) / 1000000;
#else /* POWER_NOW */
#error "Either POWER_NOW or CURRENT_NOW and VOLTAGE_NOW must be defined"
#endif /* POWER_NOW*/
@@ -171,7 +171,7 @@ int main(void)
if (pa < 0 || pb < 0) {
snprintf(power, 6, "NOPOW");
} else if (pa < 0 || pa > 9999 || pb < 0 || pb > 9) {
- snprintf(power, 6, "?????W");
+ snprintf(power, 6, "????W");
} else if (pa > 99) {
snprintf(power, 6, "%4lldW", pa);
} else {