diff options
author | Stefan Fuchs <sfuchs@gmx.de> | 2018-02-20 22:59:09 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-02-24 11:45:17 -0800 |
commit | ca4ccadcc4e2afd955e9ca22100765e9cc9be94b (patch) | |
tree | b5c7b3a1e0a546b3399b595a4cc348e9e063be70 /core | |
parent | 95a23cf4701d4918f866cb5ef1c25a5b2b380096 (diff) | |
download | subsurface-ca4ccadcc4e2afd955e9ca22100765e9cc9be94b.tar.gz |
Use duration_t for total_sac_time in struct stats_t
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'core')
-rw-r--r-- | core/statistics.c | 6 | ||||
-rw-r--r-- | core/statistics.h | 2 |
2 files changed, 4 insertions, 4 deletions
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; } } diff --git a/core/statistics.h b/core/statistics.h index 48e75594d..8a71758f7 100644 --- a/core/statistics.h +++ b/core/statistics.h @@ -33,7 +33,7 @@ typedef struct temperature_sum_t combined_temp; unsigned int combined_count; unsigned int selection_size; - unsigned int total_sac_time; + duration_t total_sac_time; bool is_year; bool is_trip; char *location; |