mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-17 20:26:17 +00:00
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
1 changed files with 10 additions and 1 deletions
11
parse.c
11
parse.c
|
@ -444,9 +444,18 @@ static void sample_start(void)
|
||||||
|
|
||||||
static void sample_end(void)
|
static void sample_end(void)
|
||||||
{
|
{
|
||||||
sample = NULL;
|
|
||||||
if (!dive)
|
if (!dive)
|
||||||
return;
|
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++;
|
dive->samples++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue