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:
parent
ee56021dfb
commit
c7e2906372
11
parse.c
11
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++;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user