diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-08-31 14:36:53 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-08-31 14:36:53 -0700 |
commit | c7e29063722a57211e00acc5ee98e05c37f89a99 (patch) | |
tree | c3675c9b9ca204ebb8fd22291d2890f1aaa6648e | |
parent | ee56021dfbc3bcc12f5917cdf481cc96c51a2b89 (diff) | |
download | subsurface-c7e29063722a57211e00acc5ee98e05c37f89a99.tar.gz |
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>
-rw-r--r-- | parse.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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++; } |