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>
This commit is contained in:
Dirk Hohndel 2013-02-08 21:40:26 +11:00
parent b119f7fcd4
commit 74ff9f1ead

4
dive.c
View file

@ -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;