commit 94b549a5ebe893bc727115ae845e51c4153f92e5
Author: dsp <[email protected]>
AuthorDate: Thu Oct 31 22:50:32 2019 -0600
Commit: Aaron Marcher <[email protected]>
CommitDate: Mon Nov 30 18:56:21 2020 +0100
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/LICENSE b/LICENSE
index 6f40379..e3983ba 100644
--- a/LICENSE
+++ b/LICENSE
@@ -22,6 +22,7 @@ Copyright 2016-2019 Joerg Jung <[email protected]>
Copyright 2019 Ingo Feinerer <[email protected]>
Copyright 2019 Ryan Kes <[email protected]>
Copyright 2019 Cem Keylan <[email protected]>
+Copyright 2019 dsp <[email protected]>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
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 <stdio.h>