From 384030bade9c5bcee64882429133fe19f93d7572 Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Mon, 15 Jun 2020 13:21:34 +0100 Subject: [PATCH] tz: more precision. --- src/bin/system/machine.c | 14 +++++++------- src/bin/system/machine.h | 2 +- src/bin/ui/ui_cpu.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/bin/system/machine.c b/src/bin/system/machine.c index 866069a..5007bbb 100644 --- a/src/bin/system/machine.c +++ b/src/bin/system/machine.c @@ -638,7 +638,7 @@ swap_out: } static void -_temperature_cpu_get(int *temperature) +_thermal_zone_temp_get(float *temperature) { #if defined(__OpenBSD__) || defined(__NetBSD__) int mibs[5] = { CTL_HW, HW_SENSORS, 0, 0, 0 }; @@ -721,7 +721,7 @@ _temperature_cpu_get(int *temperature) char *value = file_contents(path); if (value) { - *temperature = atoi(value) / 1000; + *temperature = (float)atoi(value) / 1000.0; free(value); free(type); break; @@ -1176,12 +1176,12 @@ _results_cpu(cpu_core_t **cores, int cpu_count) return total; } -int -system_temperature_cpu_get(void) +float +system_thermal_zone_temp_get(void) { - int temp; + float temp; - _temperature_cpu_get(&temp); + _thermal_zone_temp_get(&temp); return temp; } @@ -1276,7 +1276,7 @@ sys_info_all_get(void) if (_power_battery_count_get(&results->power)) _power_state_get(&results->power); - _temperature_cpu_get(&results->temperature); + _thermal_zone_temp_get(&results->temperature); if (!error) { diff --git a/src/bin/system/machine.h b/src/bin/system/machine.h index c217a1d..7f6de85 100644 --- a/src/bin/system/machine.h +++ b/src/bin/system/machine.h @@ -61,7 +61,7 @@ struct Sys_Info unsigned long incoming; unsigned long outgoing; - int temperature; + float temperature; }; Sys_Info * diff --git a/src/bin/ui/ui_cpu.c b/src/bin/ui/ui_cpu.c index 791c47b..c4a6070 100644 --- a/src/bin/ui/ui_cpu.c +++ b/src/bin/ui/ui_cpu.c @@ -100,7 +100,7 @@ ui_tab_cpu_update(Ui *ui, Sys_Info *sysinfo) if (sysinfo->temperature != INVALID_TEMP) elm_object_text_set(ui->temp_label, - eina_slstr_printf(_("Core at (%d °C)"), + eina_slstr_printf(_("Thermal Zone: %1.1f°C"), sysinfo->temperature)); EINA_LIST_FOREACH(ui->cpu_list, l, pb)