mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +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)
|
||||
{
|
||||
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…
Reference in a new issue