aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--parse.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/parse.c b/parse.c
index 58476ef15..58d446db0 100644
--- a/parse.c
+++ b/parse.c
@@ -444,9 +444,18 @@ static void sample_start(void)
static void sample_end(void)
{
- sample = NULL;
if (!dive)
return;
+
+ if (sample->time.seconds > dive->duration.seconds) {
+ if (sample->depth.mm)
+ dive->duration = sample->time;
+ }
+
+ if (sample->depth.mm > dive->maxdepth.mm)
+ dive->maxdepth.mm = sample->depth.mm;
+
+ sample = NULL;
dive->samples++;
}