diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-02-08 21:40:26 +1100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-02-08 21:40:26 +1100 |
commit | 74ff9f1eadb4381506b7f3b3e24697da6a5dec4f (patch) | |
tree | f56f0db71ca6ecb3a6be71c25b9f3b0153792956 /dive.c | |
parent | b119f7fcd49d7ed1b45b699aecf96ed6f7cb0e42 (diff) | |
download | subsurface-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.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; |