diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-10-06 09:21:27 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-10-07 05:41:48 +0300 |
commit | c32e71e64d97016d201aea26f0623de6cd65d74d (patch) | |
tree | d2dbd6a326701aba1e031a5f6508a5d811e2a34f /core/divelist.h | |
parent | cec0b703652ffb4ab53fd792bee0cbf095b38cca (diff) | |
download | subsurface-c32e71e64d97016d201aea26f0623de6cd65d74d.tar.gz |
Dive information: fix surface interval calculation
The old surface interval calculation had fundamental issues:
1) process_all_dives(), which calculates the statistics over *all*
dives was used to get the pointer to the previous dive.
2) If two dives in the table had the same time, one of those would
have been considered the "previous" dive.
3) If the dive, for which the surface interval is calculated is
not yet in the table, no previous dive would be determined.
Fix all this by creating a get_surface_interval() function and
removing the "get previous dive" functionality of process_all_dives().
Remove the process_all_dives() call from TabDiveInformation::updateData().
Reported-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/divelist.h')
-rw-r--r-- | core/divelist.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/divelist.h b/core/divelist.h index 937909d2b..af47d0f23 100644 --- a/core/divelist.h +++ b/core/divelist.h @@ -42,6 +42,7 @@ extern struct dive *first_selected_dive(); extern struct dive *last_selected_dive(); extern bool is_trip_before_after(const struct dive *dive, bool before); extern void set_dive_nr_for_current_dive(); +extern timestamp_t get_surface_interval(timestamp_t when); int get_min_datafile_version(); void reset_min_datafile_version(); |