summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordsp <dsp@2f30.org>2019-10-31 22:50:32 -0600
committerAaron Marcher <me@drkhsh.at>2020-11-30 21:23:48 +0100
commit3fc2872d1b3e62903a4af49326d42c97c11911d5 (patch)
tree7f494fe20fb7954137beaf47c3b025644d216c74
parent3ac985eb0338773cfb1d1446fc0751f1f2afea94 (diff)
downloadslstatus-3fc2872d1b3e62903a4af49326d42c97c11911d5.tar.gz
slstatus-3fc2872d1b3e62903a4af49326d42c97c11911d5.zip
Fix temperature reporting on OpenBSD
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
-rw-r--r--components/temperature.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/components/temperature.c b/components/temperature.c
index 8462d0f..8e1f222 100644
--- a/components/temperature.c
+++ b/components/temperature.c
@@ -45,7 +45,7 @@
45 } 45 }
46 46
47 /* kelvin to celsius */ 47 /* kelvin to celsius */
48 return bprintf("%d", (temp.value - 273150000) / 1E6); 48 return bprintf("%d", (int)((float)(temp.value-273150000) / 1E6));
49 } 49 }
50#elif defined(__FreeBSD__) 50#elif defined(__FreeBSD__)
51 #include <stdio.h> 51 #include <stdio.h>