diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-07-01 14:03:39 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-07-02 08:36:53 -0700 |
commit | 3209b490ddda7b029392a030e34097b921bfd025 (patch) | |
tree | a34b2e08aed2f656790ca0c085c46bd6b42f4ba3 /qt-models/CMakeLists.txt | |
parent | eec9270f32d9e9a7b11b825464b713d3160bd633 (diff) | |
download | subsurface-3209b490ddda7b029392a030e34097b921bfd025.tar.gz |
Use proper sample pointer when deciding to split dives
The dive splitting was completely wrong, because we checked the time of
the previous sample by doing
sample[i - 1].time.seconds
which is entirely wrong. The 'sample' variable is the *current* sample,
so the time of the previous sample is simply
sample[-1].time.seconds
Alternatively, we could have started from the first sample, and done
dc->sample[i - 1].time.seconds
but mixing the two concepts up just gets you a random sample pointer
that is likely not a valid sample at all, and obviously does not have
the right time at all.
As a result, dive splitting was pretty much random. Sometimes it worked
purely by mistake, because the rest of the logic was right (ie we _had_
found the right point where we reached the surface in the dive etc, the
"previous sample time" was simply used to decide if the surface interval
was sufficient to split the dive up).
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models/CMakeLists.txt')
0 files changed, 0 insertions, 0 deletions