]> git.ipfire.org Git - collecty.git/blobdiff - src/_collectymodule.c
disk: Convert temperatures to Kelvin
[collecty.git] / src / _collectymodule.c
index 38ade7df096446ff8e82c46a44f5eab162bef545..e57970eabf904e0d5380de7d56b17e075acb8628 100644 (file)
@@ -254,7 +254,8 @@ static PyObject* BlockDevice_get_temperature(PyObject* self) {
        if (r)
                return NULL;
 
        if (r)
                return NULL;
 
-       return PyLong_FromUnsignedLongLong((unsigned long long)mkelvin);
+       // Convert the temperature to Kelvin
+       return PyFloat_FromDouble((double)mkelvin / 1000.0);
 }
 
 static PyGetSetDef BlockDevice_getsetters[] = {
 }
 
 static PyGetSetDef BlockDevice_getsetters[] = {