1
0
Fork 0

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
This commit is contained in:
dsp 2019-10-31 22:50:32 -06:00 committed by Aaron Marcher
parent 3ac985eb03
commit 3fc2872d1b

View file

@ -45,7 +45,7 @@
} }
/* kelvin to celsius */ /* kelvin to celsius */
return bprintf("%d", (temp.value - 273150000) / 1E6); return bprintf("%d", (int)((float)(temp.value-273150000) / 1E6));
} }
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__)
#include <stdio.h> #include <stdio.h>