From ca4ccadcc4e2afd955e9ca22100765e9cc9be94b Mon Sep 17 00:00:00 2001 From: Stefan Fuchs Date: Tue, 20 Feb 2018 22:59:09 +0100 Subject: Use duration_t for total_sac_time in struct stats_t Signed-off-by: Stefan Fuchs --- core/statistics.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/statistics.c') diff --git a/core/statistics.c b/core/statistics.c index c7cd213ff..678843b99 100644 --- a/core/statistics.c +++ b/core/statistics.c @@ -73,15 +73,15 @@ static void process_dive(struct dive *dp, stats_t *stats) stats->total_average_depth_time.seconds); } if (dp->sac > 100) { /* less than .1 l/min is bogus, even with a pSCR */ - sac_time = stats->total_sac_time + duration; - stats->avg_sac.mliter = lrint((1.0 * stats->total_sac_time * stats->avg_sac.mliter + + sac_time = stats->total_sac_time.seconds + duration; + stats->avg_sac.mliter = lrint((1.0 * stats->total_sac_time.seconds * stats->avg_sac.mliter + duration * dp->sac) / sac_time); if (dp->sac > stats->max_sac.mliter) stats->max_sac.mliter = dp->sac; if (stats->min_sac.mliter == 0 || dp->sac < stats->min_sac.mliter) stats->min_sac.mliter = dp->sac; - stats->total_sac_time = sac_time; + stats->total_sac_time.seconds = sac_time; } } -- cgit v1.2.3-70-g09d2