dive parsing: enforce maxdepth and dive duration

If we see samples from past the dive duration, update the dive duration.
Likewise with maxdepth.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2011-08-31 14:36:53 -07:00
parent ee56021dfb
commit c7e2906372

11
parse.c
View file

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