subsurface/core
Linus Torvalds 914cdb102b 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 <torvalds@linux-foundation.org>
2024-08-26 21:01:32 -07:00
..
settings Planner: Improve Gas Handling in CCR Mode. 2024-08-26 12:36:31 +12:00
subsurface-qt core: turn picture-table into std::vector<> 2024-08-13 19:28:30 +02:00
android.cpp core: move startup function declarations to subsurfacestartup.h 2024-08-13 19:28:30 +02:00
btdiscovery.cpp import: turn C-string in device_data_t into std::strings 2024-08-13 19:28:30 +02:00
btdiscovery.h import: turn C-string in device_data_t into std::strings 2024-08-13 19:28:30 +02:00
checkcloudconnection.cpp preferences: use std::string in struct preferences 2024-08-13 19:28:30 +02:00
checkcloudconnection.h cloudstorage: try alternative server if first connection fails 2021-04-19 12:51:01 -07:00
cloudstorage.cpp preferences: use std::string in struct preferences 2024-08-13 19:28:30 +02:00
cloudstorage.h mobile: add ability to delete cloud account 2022-08-13 14:08:37 -07:00
CMakeLists.txt core: remove filterconstraint C boilerplate code 2024-08-13 19:28:30 +02:00
cochran.cpp core: move add_cylinder() to struct cylinder_table 2024-08-13 19:28:30 +02:00
cochran.h Cochran import: better support for older models 2017-05-31 21:53:00 -07:00
color.cpp profile: rename GF_LINE color to DURATION_LINE 2021-05-08 13:40:24 +02:00
color.h cleanup: remove enum typedef in color.h 2024-08-13 19:28:30 +02:00
compressibility.r
configuredivecomputer.cpp import: turn C-string in device_data_t into std::strings 2024-08-13 19:28:30 +02:00
configuredivecomputer.h computer configuration: use value semantics for DeviceDetails 2024-03-24 17:53:19 +01:00
configuredivecomputerthreads.cpp computer configuration: use value semantics for DeviceDetails 2024-03-24 17:53:19 +01:00
configuredivecomputerthreads.h computer configuration: use value semantics for DeviceDetails 2024-03-24 17:53:19 +01:00
connectionlistmodel.cpp core/bt: ensure that BT/BLE addresses with name sort first 2020-05-15 04:05:06 +03:00
connectionlistmodel.h Mobile: reinstate roleNames function in ConnectionListModel 2019-04-16 23:43:14 +12:00
datatrak.cpp core: move cylinder related functions to struct dive 2024-08-13 19:28:30 +02:00
datatrak.h core: turn a memblock in the parser to std::string 2024-03-10 11:01:42 +13:00
deco.cpp core: move get_surface_pressure() to struct dive 2024-08-13 19:28:30 +02:00
deco.h core: add default initialization to sruct deco_state 2024-08-13 19:28:30 +02:00
device.cpp core: move has_dive() function into struct divelist 2024-08-13 19:28:30 +02:00
device.h core: remove device-fingerprint C access code 2024-08-13 19:28:30 +02:00
devicedetails.cpp computer configuration: use value semantics for DeviceDetails 2024-03-24 17:53:19 +01:00
devicedetails.h computer configuration: use value semantics for DeviceDetails 2024-03-24 17:53:19 +01:00
dive.cpp Planner: Improve Gas Handling in CCR Mode. 2024-08-26 12:36:31 +12:00
dive.h Planner: Improve Gas Handling in CCR Mode. 2024-08-26 12:36:31 +12:00
divecomputer.cpp Fix Suunto FIT file import dive duration mis-calculation 2024-08-26 21:01:32 -07:00
divecomputer.h Planner: Improve Gas Handling in CCR Mode. 2024-08-26 12:36:31 +12:00
divefilter.cpp core: turn C dive-table into an owning table 2024-08-13 19:28:30 +02:00
divefilter.h map: use value semantics for MapLocation 2024-08-13 19:28:30 +02:00
divelist.cpp core: move gas_volume() to cylinder_t 2024-08-13 19:28:30 +02:00
divelist.h core: move clone_delete_divecomputer() to struct dive_table 2024-08-13 19:28:30 +02:00
divelog.cpp core: move merge_dives() functios to struct dive_table 2024-08-13 19:28:30 +02:00
divelog.h core: move process_import_dives() and related functions to divelog 2024-08-13 19:28:30 +02:00
divelogexportlogic.cpp core: C++-ify statistics.c 2024-08-13 19:28:30 +02:00
divelogexportlogic.h avoid duplicate and inconsistent applying of QDir::separator() 2019-03-27 07:36:33 -07:00
divemode.h Planner: Improve Gas Handling in CCR Mode. 2024-08-26 12:36:31 +12:00
divesite.cpp core: move divesite_has_gps_information() to struct dive_site 2024-08-13 19:28:30 +02:00
divesite.h core: move divesite_has_gps_information() to struct dive_site 2024-08-13 19:28:30 +02:00
divesitehelpers.cpp core: convert taxonomy.c to C++ 2024-08-13 19:28:30 +02:00
divesitehelpers.h [Bug #2934] Geo Lookup - support for remote dive sites 2020-09-05 17:34:15 +02:00
divesitetable.h core: turn C dive-table into an owning table 2024-08-13 19:28:30 +02:00
downloadfromdcthread.cpp core: turn C dive-table into an owning table 2024-08-13 19:28:30 +02:00
downloadfromdcthread.h uemis: replace C-strings by std::string and std::string_view 2024-08-13 19:28:30 +02:00
equipment.cpp code cleanup: use std::move() to potentially void copies 2024-08-18 16:26:31 +02:00
equipment.h core: add move constructor/copy assignment to weight and cylinder 2024-08-17 23:37:00 +12:00
errorhelper.cpp core: use std::string in error_callback 2024-08-13 19:28:30 +02:00
errorhelper.h core: use std::string in error_callback 2024-08-13 19:28:30 +02:00
event.cpp core: add missing #include <tuple> 2024-08-19 22:47:59 +02:00
event.h core: fold event-related functions into event class 2024-08-13 19:28:30 +02:00
eventtype.cpp core: fold event-related functions into event class 2024-08-13 19:28:30 +02:00
eventtype.h core: turn event-list of divecomputer into std::vector<> 2024-08-13 19:28:30 +02:00
exif.cpp cleanup: move declaration of utc_mk* functions to new subsurface-time.h header 2020-05-01 09:42:31 -07:00
exif.h Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
extradata.h core: convert dive computer extra data to C++ 2024-08-13 19:28:30 +02:00
file.cpp preferences: use std::string in struct preferences 2024-08-13 19:28:30 +02:00
file.h build: remove extern "C" linkage 2024-08-13 19:28:30 +02:00
filterconstraint.cpp core: move time_during_dive_with_offset() to struct dive 2024-08-13 19:28:30 +02:00
filterconstraint.h core: remove filterconstraint C boilerplate code 2024-08-13 19:28:30 +02:00
filterpreset.cpp core: remove filterconstraint C boilerplate code 2024-08-13 19:28:30 +02:00
filterpreset.h core: remove filterconstraint C boilerplate code 2024-08-13 19:28:30 +02:00
filterpresettable.cpp filter: use std::move() to pass around std::string 2024-08-17 23:37:00 +12:00
filterpresettable.h core: remove filterconstraint C boilerplate code 2024-08-13 19:28:30 +02:00
format.cpp download: replace progress_bar_text by std::string 2024-08-13 19:28:30 +02:00
format.h download: replace progress_bar_text by std::string 2024-08-13 19:28:30 +02:00
fulltext.cpp core: turn C dive-table into an owning table 2024-08-13 19:28:30 +02:00
fulltext.h fulltext: replace plain pointer by std::unique_ptr<> 2024-08-13 19:28:30 +02:00
gas-model.cpp core: convert gas-model.c to C++ 2024-08-13 19:28:30 +02:00
gas.cpp core: move gasname() to struct gasmix 2024-08-13 19:28:30 +02:00
gas.h core: move gasname() to struct gasmix 2024-08-13 19:28:30 +02:00
gaspressures.cpp pressures: do floating point division when interpolating 2024-08-17 23:37:00 +12:00
gaspressures.h core: remove __cplusplus ifdefs 2024-08-13 19:28:30 +02:00
gettext.h build: remove extern "C" linkage 2024-08-13 19:28:30 +02:00
gettextfromc.cpp build: remove extern "C" linkage 2024-08-13 19:28:30 +02:00
gettextfromc.h build: remove extern "C" linkage 2024-08-13 19:28:30 +02:00
git-access.cpp preferences: use std::string in struct preferences 2024-08-13 19:28:30 +02:00
git-access.h general: remove (void) function parameter declarations 2024-08-13 19:28:30 +02:00
globals.cpp core: add class that collects global objects to be deleted on exit 2022-03-16 13:06:06 -07:00
globals.h core: add class that collects global objects to be deleted on exit 2022-03-16 13:06:06 -07:00
imagedownloader.cpp core: default initialize units-type objects to 0 2024-08-13 19:28:30 +02:00
imagedownloader.h Profile: add "synchronous" mode for picture plotting 2019-02-07 16:06:43 +01:00
import-cobalt.cpp import: use std::string for location in cobalt-import 2024-08-13 19:28:30 +02:00
import-csv.cpp core: turn C dive-table into an owning table 2024-08-13 19:28:30 +02:00
import-csv.h build: remove extern "C" linkage 2024-08-13 19:28:30 +02:00
import-divinglog.cpp core: move cylinder related functions to struct dive 2024-08-13 19:28:30 +02:00
import-seac.cpp seac import: report database error 2024-08-17 23:37:00 +12:00
import-shearwater.cpp core: turn struct dive string data into std::string 2024-08-13 19:28:30 +02:00
import-suunto.cpp suunto import: give and free error message 2024-08-17 23:37:00 +12:00
interpolate.h cleanup: move interpolate inline function to its own header file 2020-10-25 13:59:52 -07:00
ios.cpp core: move startup function declarations to subsurfacestartup.h 2024-08-13 19:28:30 +02:00
libdivecomputer.cpp core: move gas_volume() to cylinder_t 2024-08-13 19:28:30 +02:00
libdivecomputer.h core: add copy constructors/assignment operators to device_data_t 2024-08-17 23:37:00 +12:00
liquivision.cpp code cleanup: use std::move() to potentially void copies 2024-08-18 16:26:31 +02:00
load-git.cpp core: remove accessor get_dive_site_for_dive() 2024-08-13 19:28:30 +02:00
macos.cpp core: move startup function declarations to subsurfacestartup.h 2024-08-13 19:28:30 +02:00
membuffer.cpp core: remove add_to_string() function 2024-08-13 19:28:30 +02:00
membuffer.h core: remove add_to_string() function 2024-08-13 19:28:30 +02:00
metadata.cpp build: remove extern "C" linkage 2024-08-13 19:28:30 +02:00
metadata.h build: remove extern "C" linkage 2024-08-13 19:28:30 +02:00
metrics.cpp core: remove DPR from IconMetrics class 2021-12-17 11:54:23 -08:00
metrics.h core: remove DPR from IconMetrics class 2021-12-17 11:54:23 -08:00
namecmp.h core: remove __cplusplus ifdefs 2024-08-13 19:28:30 +02:00
ostctools.cpp ostctools: avoid string copy 2024-08-17 23:37:00 +12:00
owning_table.h core: turn C dive-table into an owning table 2024-08-13 19:28:30 +02:00
parse-gpx.cpp cleanup: replace fprintf to stderr by report_info() 2024-04-23 07:47:11 +07:00
parse-gpx.h cleanup: more Coverity silencing 2024-01-17 14:23:19 -08:00
parse-xml.cpp core: move get_or_create_cylinder() to struct dive 2024-08-13 19:28:30 +02:00
parse.cpp core: remove add_empty_cylinder() 2024-08-13 19:28:30 +02:00
parse.h parser: move atoi_n to import-divinglog.cpp 2024-08-13 19:28:30 +02:00
picture.cpp core: turn C dive-table into an owning table 2024-08-13 19:28:30 +02:00
picture.h core: turn picture-table into std::vector<> 2024-08-13 19:28:30 +02:00
planner.cpp Planner: Improve Gas Handling in CCR Mode. 2024-08-26 12:36:31 +12:00
planner.h Planner: Improve Gas Handling in CCR Mode. 2024-08-26 12:36:31 +12:00
plannernotes.cpp Planner: Improve Gas Handling in CCR Mode. 2024-08-26 12:36:31 +12:00
pref.cpp Planner: Improve Gas Handling in CCR Mode. 2024-08-26 12:36:31 +12:00
pref.h Planner: Improve Gas Handling in CCR Mode. 2024-08-26 12:36:31 +12:00
profile.cpp code hygiene: use std::swap instead of temporary variable 2024-08-19 13:14:47 +02:00
profile.h profile: add move constructor and assignment operator to plot_info 2024-08-17 23:37:00 +12:00
qt-ble.cpp general: remove (void) function parameter declarations 2024-08-13 19:28:30 +02:00
qt-ble.h general: remove (void) function parameter declarations 2024-08-13 19:28:30 +02:00
qt-gui.h mobile/UI: remember the system default font size 2021-01-19 12:35:29 -08:00
qt-init.cpp preferences: use std::string in struct preferences 2024-08-13 19:28:30 +02:00
qthelper.cpp Planner: Improve Gas Handling in CCR Mode. 2024-08-26 12:36:31 +12:00
qthelper.h Planner: Improve Gas Handling in CCR Mode. 2024-08-26 12:36:31 +12:00
qtserialbluetooth.cpp cleanup: remove typedef in qtserialbluetooth.cpp 2024-08-13 19:28:30 +02:00
range.h fix copy/paste of dive-site 2024-08-17 23:34:16 +12:00
sample.cpp core: simplify default initialization of struct sample 2024-08-13 19:28:30 +02:00
sample.h core: simplify default initialization of struct sample 2024-08-13 19:28:30 +02:00
save-git.cpp core: move get_dive_location()/_country() to struct dive 2024-08-13 19:28:30 +02:00
save-html.cpp core: move get_dive_location()/_country() to struct dive 2024-08-13 19:28:30 +02:00
save-html.h core: turn C dive-table into an owning table 2024-08-13 19:28:30 +02:00
save-profiledata.cpp desktop: use std::string to format subtitles 2024-08-13 19:28:30 +02:00
save-profiledata.h desktop: use std::string to format subtitles 2024-08-13 19:28:30 +02:00
save-xml.cpp core: move data file version functions into version.cpp/h 2024-08-13 19:28:30 +02:00
selection.cpp core: make find_next_visible_dive() member of dive_table 2024-08-13 19:28:30 +02:00
selection.h general: remove (void) function parameter declarations 2024-08-13 19:28:30 +02:00
serial_ftdi.cpp general: remove (void) function parameter declarations 2024-08-13 19:28:30 +02:00
serial_usb_android.cpp Cleanup: Remove 'context' Reference from Logging Defines. 2024-05-16 16:39:48 +02:00
serial_usb_android.h android/usb: pass in the UsbDevice when downloading 2020-03-16 07:58:20 -07:00
sha1.cpp core: C++-ify SHA1 interface 2024-08-13 19:28:30 +02:00
sha1.h core: remove __cplusplus ifdefs 2024-08-13 19:28:30 +02:00
statistics.cpp core: move gas_volume() to cylinder_t 2024-08-13 19:28:30 +02:00
statistics.h core: default initialize units-type objects to 0 2024-08-13 19:28:30 +02:00
string-format.cpp core: move gasname() to struct gasmix 2024-08-13 19:28:30 +02:00
string-format.h core: turn trip-table into our own sorted_owning_table 2024-08-13 19:28:30 +02:00
strtod.cpp build: remove extern "C" linkage 2024-08-13 19:28:30 +02:00
subsurface-float.h core: remove __cplusplus ifdefs 2024-08-13 19:28:30 +02:00
subsurface-string.cpp Use std::vector<string> instead of QStringList in main() 2024-04-23 07:47:11 +07:00
subsurface-string.h preferences: use std::string in struct preferences 2024-08-13 19:28:30 +02:00
subsurface-time.h undo: pass dive as unique_ptr to addDive() 2024-08-13 19:28:30 +02:00
subsurfacestartup.cpp preferences: use std::string in struct preferences 2024-08-13 19:28:30 +02:00
subsurfacestartup.h core: move startup function declarations to subsurfacestartup.h 2024-08-13 19:28:30 +02:00
subsurfacesysinfo.cpp build: remove extern "C" linkage 2024-08-13 19:28:30 +02:00
subsurfacesysinfo.h build: remove extern "C" linkage 2024-08-13 19:28:30 +02:00
tag.cpp core: remove structured_list.h 2024-08-13 19:28:30 +02:00
tag.h core: port tag-list to C++ 2024-08-13 19:28:30 +02:00
taxonomy.cpp core: move constructLocationTags from divesite.cpp to taxonomy.cpp 2024-08-13 19:28:30 +02:00
taxonomy.h preferences: use std::string in struct preferences 2024-08-13 19:28:30 +02:00
time.cpp core: move *_surface_pressure() functions into struct dive 2024-08-13 19:28:30 +02:00
trip.cpp core: move get_dive_location()/_country() to struct dive 2024-08-13 19:28:30 +02:00
trip.h core: move functions into trip-structure 2024-08-13 19:28:30 +02:00
triptable.cpp core: move functions into trip-structure 2024-08-13 19:28:30 +02:00
triptable.h core: move functions into trip-structure 2024-08-13 19:28:30 +02:00
uemis-downloader.cpp uemis downloader: use move instead of copy to return string 2024-08-17 23:37:00 +12:00
uemis.cpp core: move get_or_create_cylinder() to struct dive 2024-08-13 19:28:30 +02:00
uemis.h core: remove __cplusplus ifdefs 2024-08-13 19:28:30 +02:00
units.cpp core: move get_distance() from divesite.cpp to units.cpp 2024-08-13 19:28:30 +02:00
units.h Update core/units.h 2024-08-13 19:28:30 +02:00
unix.cpp core: move startup function declarations to subsurfacestartup.h 2024-08-13 19:28:30 +02:00
uploadDiveLogsDE.cpp core: turn C dive-table into an owning table 2024-08-13 19:28:30 +02:00
uploadDiveLogsDE.h core: remove __cplusplus ifdefs 2024-08-13 19:28:30 +02:00
uploadDiveShare.cpp core: remove membufferpp 2024-08-13 19:28:30 +02:00
uploadDiveShare.h core: remove __cplusplus ifdefs 2024-08-13 19:28:30 +02:00
version.cpp core: move data file version functions into version.cpp/h 2024-08-13 19:28:30 +02:00
version.h core: move data file version functions into version.cpp/h 2024-08-13 19:28:30 +02:00
videoframeextractor.cpp preferences: use std::string in struct preferences 2024-08-13 19:28:30 +02:00
videoframeextractor.h Dive media: Extract thumbnails from videos with ffmpeg 2018-07-28 15:31:25 -07:00
webservice.h general: remove (void) function parameter declarations 2024-08-13 19:28:30 +02:00
windows.cpp core: move startup function declarations to subsurfacestartup.h 2024-08-13 19:28:30 +02:00
windowtitleupdate.cpp build: remove extern "C" linkage 2024-08-13 19:28:30 +02:00
windowtitleupdate.h Cleanup: Make WindowsTitleUpdate a global object 2018-07-30 13:55:23 -07:00
worldmap-options.h Add SPDX header to core C files 2017-04-29 13:32:55 -07:00
worldmap-save.cpp core: move get_dive_location()/_country() to struct dive 2024-08-13 19:28:30 +02:00
worldmap-save.h build: remove extern "C" linkage 2024-08-13 19:28:30 +02:00
xmlparams.cpp build: remove extern "C" linkage 2024-08-13 19:28:30 +02:00
xmlparams.h build: remove extern "C" linkage 2024-08-13 19:28:30 +02:00
xmp_parser.cpp cleanup: move declaration of utc_mk* functions to new subsurface-time.h header 2020-05-01 09:42:31 -07:00
xmp_parser.h Metadata: rudimentary support for XMP metadataa in MP4-based videos 2018-09-25 14:59:14 -07:00