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:
3ac985e
)
Fix temperature reporting on OpenBSD
author
dsp
<dsp@2f30.org>
Fri, 1 Nov 2019 04:50:32 +0000
(22:50 -0600)
committer
Aaron Marcher
<me@drkhsh.at>
Mon, 30 Nov 2020 20:23:48 +0000
(21:23 +0100)
On OpenBSD although the formula is correct due to integer division a
temperature of for example 54 celsius appears as 5. this patch first
treats it as a floating point op before retaining the non decimal digits
components/temperature.c
patch
|
blob
|
history
diff --git
a/components/temperature.c
b/components/temperature.c
index 8462d0fc65e82727c44c4b93b01db15a59e69839..8e1f222a5178cca002120d7478e6c8f510987f98 100644
(file)
--- a/
components/temperature.c
+++ b/
components/temperature.c
@@
-45,7
+45,7
@@
}
/* kelvin to celsius */
- return bprintf("%d", (
temp.value - 273150000) / 1E6
);
+ return bprintf("%d", (
int)((float)(temp.value-273150000) / 1E6)
);
}
#elif defined(__FreeBSD__)
#include <stdio.h>