summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-08 21:40:26 +1100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-08 21:40:26 +1100
commit74ff9f1eadb4381506b7f3b3e24697da6a5dec4f (patch)
treef56f0db71ca6ecb3a6be71c25b9f3b0153792956 /dive.c
parentb119f7fcd49d7ed1b45b699aecf96ed6f7cb0e42 (diff)
downloadsubsurface-74ff9f1eadb4381506b7f3b3e24697da6a5dec4f.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c4
1 files changed, 2 insertions, 2 deletions
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;