[PATCH] Avoid zero degrees Kelvin in yearly statistics
Henrik Brautaset Aronsen
subsurface at henrik.synth.no
Tue Oct 16 09:14:34 PDT 2012
Maximum and minimum degrees in the yearly statistics were displayed
as -273.1°C if no temperature info was present.
H
-------------- next part --------------
>From 7d9aad01133bc03980f66a2d109c9ef909e518ad Mon Sep 17 00:00:00 2001
From: Henrik Brautaset Aronsen <subsurface at henrik.synth.no>
Date: Tue, 16 Oct 2012 18:13:16 +0200
Subject: [PATCH] Avoid zero degrees Kelvin in yearly statistics
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Maximum and minimum degrees in the yearly statistics were displayed
as -273.1°C if no temperature info was present.
Signed-off-by: Henrik Brautaset Aronsen <subsurface at henrik.synth.no>
---
statistics.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/statistics.c b/statistics.c
index fe37950..047c6ea 100644
--- a/statistics.c
+++ b/statistics.c
@@ -290,12 +290,20 @@ static void process_interval_stats(stats_t stats_interval, GtkTreeIter *parent,
add_cell_to_tree(store, "", 12, row);
}
/* Coldest water temperature */
- snprintf(value_str, sizeof(value_str), "%.1f %s\t", value, unit);
- add_cell_to_tree(store, value_str, 13, row);
+ if (value > -100.0) {
+ snprintf(value_str, sizeof(value_str), "%.1f %s\t", value, unit);
+ add_cell_to_tree(store, value_str, 13, row);
+ } else {
+ add_cell_to_tree(store, "", 13, row);
+ }
/* Warmest water temperature */
value = get_temp_units(stats_interval.max_temp, &unit);
- snprintf(value_str, sizeof(value_str), "%.1f %s", value, unit);
- add_cell_to_tree(store, value_str, 14, row);
+ if (value > -100.0) {
+ snprintf(value_str, sizeof(value_str), "%.1f %s", value, unit);
+ add_cell_to_tree(store, value_str, 14, row);
+ } else {
+ add_cell_to_tree(store, "", 14, row);
+ }
}
void clear_statistics()
--
1.7.11.5
More information about the subsurface
mailing list