From 74ff9f1eadb4381506b7f3b3e24697da6a5dec4f Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 8 Feb 2013 21:40:26 +1100 Subject: Fix duration calculation Some days I'm just a f*cking moron. That code was so stupid that I'm lacking words. I replaced using the first divecomputer with using the last divecomputer. When what I wanted was to use the maximum duration. This looks better. Signed-off-by: Dirk Hohndel --- dive.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'dive.c') diff --git a/dive.c b/dive.c index 6b45d5355..afe115376 100644 --- a/dive.c +++ b/dive.c @@ -221,10 +221,10 @@ static void update_duration(duration_t *duration, int new) int get_duration_in_sec(struct dive *dive) { - int duration; + int duration = 0; struct divecomputer *dc = &dive->dc; do { - duration = dc->duration.seconds; + duration = MAX(duration, dc->duration.seconds); dc = dc->next; } while (dc); return duration; -- cgit v1.2.3-70-g09d2