- set_label(info_stat_w.gas_used, "");
- /* and now do the statistics */
- set_label(info_stat_w.total_time, get_time_string(info_stat.total_time.seconds, 0));
- set_label(info_stat_w.avg_time, get_time_string(info_stat.total_time.seconds / dive_table.nr, 0));
- value = get_depth_units(info_stat.max_depth.mm, &decimals, &unit);
- set_label(info_stat_w.max_overall_depth, "%.*f %s", decimals, value, unit);
- value = get_depth_units(info_stat.avg_depth.mm, &decimals, &unit);
- set_label(info_stat_w.avg_overall_depth, "%.*f %s", decimals, value, unit);
- value = get_volume_units(info_stat.max_sac.mliter, &decimals, &unit);
- set_label(info_stat_w.max_sac, "%.*f %s/min", decimals, value, unit);
- value = get_volume_units(info_stat.min_sac.mliter, &decimals, &unit);
- set_label(info_stat_w.min_sac, "%.*f %s/min", decimals, value, unit);
- value = get_volume_units(info_stat.avg_sac.mliter, &decimals, &unit);
- set_label(info_stat_w.avg_sac, "%.*f %s/min", decimals, value, unit);
+ set_label(single_w.gas_used, "");
+}
+
+static void show_total_dive_stats(struct dive *dive)
+{
+ double value;
+ int decimals;
+ const char *unit;
+
+ set_label(stats_w.total_time, get_time_string(stats.total_time.seconds, 0));
+ set_label(stats_w.avg_time, get_time_string(stats.total_time.seconds / dive_table.nr, 0));
+ set_label(stats_w.longest_time, get_time_string(stats.longest_time.seconds, 0));
+ set_label(stats_w.shortest_time, get_time_string(stats.shortest_time.seconds, 0));
+ value = get_depth_units(stats.max_depth.mm, &decimals, &unit);
+ set_label(stats_w.max_overall_depth, "%.*f %s", decimals, value, unit);
+ value = get_depth_units(stats.min_depth.mm, &decimals, &unit);
+ set_label(stats_w.min_overall_depth, "%.*f %s", decimals, value, unit);
+ value = get_depth_units(stats.avg_depth.mm, &decimals, &unit);
+ set_label(stats_w.avg_overall_depth, "%.*f %s", decimals, value, unit);
+ value = get_volume_units(stats.max_sac.mliter, &decimals, &unit);
+ set_label(stats_w.max_sac, "%.*f %s/min", decimals, value, unit);
+ value = get_volume_units(stats.min_sac.mliter, &decimals, &unit);
+ set_label(stats_w.min_sac, "%.*f %s/min", decimals, value, unit);
+ value = get_volume_units(stats.avg_sac.mliter, &decimals, &unit);
+ set_label(stats_w.avg_sac, "%.*f %s/min", decimals, value, unit);
+}
+
+void show_dive_stats(struct dive *dive)
+{
+ /* they have to be called in this order, as 'total' depends on
+ * calculations done in 'single' */
+ show_single_dive_stats(dive);
+ show_total_dive_stats(dive);