소스 검색

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
dsp 6 년 전
부모
커밋
3fc2872d1b
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      components/temperature.c

+ 1 - 1
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>