summaryrefslogtreecommitdiffstats
path: root/statistics.c
diff options
context:
space:
mode:
authorGravatar Henrik Brautaset Aronsen <subsurface@henrik.synth.no>2012-10-16 18:14:34 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-10-16 09:19:48 -0700
commit13cc5afb7f3e0873d6fc94a9cbdfafc1b05d3800 (patch)
tree42ddc9a4c2895e0ded6d2fa7261f33e42d9d9eaf /statistics.c
parentfaff4d29dd5e9ebec81a90787880874af98d6e6a (diff)
downloadsubsurface-13cc5afb7f3e0873d6fc94a9cbdfafc1b05d3800.tar.gz
Avoid zero degrees Kelvin in yearly statistics
Maximum and minimum degrees in the yearly statistics were displayed as -273.1°C if no temperature info was present. H From 7d9aad01133bc03980f66a2d109c9ef909e518ad Mon Sep 17 00:00:00 2001 From: Henrik Brautaset Aronsen <subsurface@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@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'statistics.c')
-rw-r--r--statistics.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/statistics.c b/statistics.c
index fe379505b..047c6ea1e 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()