diff options
author | Samuel FORESTIER <dev@samuel.domains> | 2019-08-21 19:20:46 +0200 |
---|---|---|
committer | Samuel FORESTIER <dev@samuel.domains> | 2019-08-21 19:20:46 +0200 |
commit | 10c4f2afdfddeee43c2f7f4bdf5bc7ace0069815 (patch) | |
tree | 749519f5752cc9b7c8a1ec6a4de2d5be97a0320f /prog | |
parent | 7478a7da14d948e4cd738d515e1d20ab7e528701 (diff) | |
download | lm-sensors-git-10c4f2afdfddeee43c2f7f4bdf5bc7ace0069815.tar.gz |
Fixes Fahrenheit missing conversion when data are JSON-formatted
Diffstat (limited to 'prog')
-rw-r--r-- | prog/sensors/chips.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 5d4d2f77..83264c9c 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -69,6 +69,11 @@ void print_chip_raw(const sensors_chip_name *name) } } +static inline double deg_ctof(double cel) +{ + return cel * (9.0F / 5.0F) + 32.0F; +} + void print_chip_json(const sensors_chip_name *name) { int a, b, cnt, subCnt, err; @@ -102,6 +107,8 @@ void print_chip_json(const sensors_chip_name *name) } else { if (subCnt > 0) printf(",\n"); + if (fahrenheit) + val = deg_ctof(val); printf(" \"%s\": %.3f", sub->name, val); subCnt++; } @@ -121,11 +128,6 @@ void print_chip_json(const sensors_chip_name *name) static const char hyst_str[] = "hyst"; -static inline double deg_ctof(double cel) -{ - return cel * (9.0F / 5.0F) + 32.0F; -} - static void print_label(const char *label, int space) { int len = strlen(label)+1; |