X-Git-Url: https://git.wpitchoune.net/gitweb/?p=psensor.git;a=blobdiff_plain;f=src%2Flib%2Fpsensor.c;h=79095b9ee0b0354cbbc7b719563d19b2e6071535;hp=138b19f3a1b9a59099e93dca198a59fa0ad48d2b;hb=a57708401519afe0a8dce1a9704db1af1cc8f10d;hpb=e57d7f801ae20f02e0cb28107a89b31fa51de1c1 diff --git a/src/lib/psensor.c b/src/lib/psensor.c index 138b19f..79095b9 100644 --- a/src/lib/psensor.c +++ b/src/lib/psensor.c @@ -198,7 +198,7 @@ int is_fan_type(unsigned int type) return type & SENSOR_TYPE_FAN; } -static double celcius_to_fahrenheit(double c) +double celcius_to_fahrenheit(double c) { return c * (9.0/5.0) + 32; } @@ -449,10 +449,14 @@ const char *psensor_type_to_str(unsigned int type) } -const char *psensor_type_to_unit_str(unsigned int type) +const char *psensor_type_to_unit_str(unsigned int type, int use_celcius) { - if (type & SENSOR_TYPE_TEMP) - return _("C"); + if (type & SENSOR_TYPE_TEMP) { + if (use_celcius) + return _("C"); + else + return _("F"); + } if (type & SENSOR_TYPE_FAN) return _("RPM");