Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Suunto FIT file import dive duration mis-calculation
The Suunto FIT files end up creating a sample every second, but a lot of those samples with no depth information, marked as "depth.mm" being negative. That doesn't end up being a problem for subsurface, _except_ that it really confuses our "dc_fixup_duration()" logic, and the dive duration ends up being completely nonsensical (generally roughly by a factor of five: every tenth sample has a depth, and we only count samples that "begin or end under water" as being relevant for the dive duration, so two out of the ten samples will count towards the dive time). Saving the dive will then not save these invalid depths, so saving and reloading the dive ends up fixing the dive duration calculation. The fix is trivial - we just ignore samples with negative depth in dc_fixup_duration(). The FIT file parser should probably be taught to not even bother sending empty samples to subsurface, but that's a separate cleanup. This fixes the actual bad behavior. Signed-off-by: Linus Torvalds <[email protected]>
- Loading branch information