fixed cpu load when fahrenheit is enabled.
[psensor.git] / src / lib / psensor.c
index c399544..4c3ad5c 100644 (file)
@@ -233,6 +233,9 @@ psensor_value_to_str(unsigned int type, double value, int use_celcius)
 
        unit = psensor_type_to_unit_str(type, use_celcius);
 
+       if (is_temp_type(type) && !use_celcius)
+               value = celcius_to_fahrenheit(value);
+
        sprintf(str, "%.0f%s", value, unit);
 
        return str;
@@ -402,7 +405,7 @@ double get_max_temp(struct psensor **sensors)
 
 struct psensor **get_all_sensors(int use_libatasmart, int values_max_length)
 {
-       struct psensor **psensors = NULL;
+       struct psensor **psensors;
        struct psensor **tmp_psensors;
 
        psensors = lmsensor_psensor_list_add(NULL, values_max_length);