From: dsp Date: Fri, 1 Nov 2019 04:50:32 +0000 (-0600) Subject: Fix temperature reporting on OpenBSD X-Git-Url: https://git.atheridis.org/?a=commitdiff_plain;h=3fc2872d1b3e62903a4af49326d42c97c11911d5;p=suckless%2Fslstatus.git 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 --- 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 @@ } /* kelvin to celsius */ - return bprintf("%d", (temp.value - 273150000) / 1E6); + return bprintf("%d", (int)((float)(temp.value-273150000) / 1E6)); } #elif defined(__FreeBSD__) #include