diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-19 15:31:35 -1000 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-11-19 20:56:16 -0800 |
commit | 2c3850110b541d531ae55e74fd6a2532495636f5 (patch) | |
tree | ffef8b4e62cf55269404ae781c51bf156d275dd6 /libdivecomputer.c | |
parent | cfaa4944527886e99bda8851b7a5d2f2c2e625f3 (diff) | |
download | subsurface-2c3850110b541d531ae55e74fd6a2532495636f5.tar.gz |
When downloading from a dive computer, stop at mergeable dives
The divecomputer download code will stop at a matching dive (unless
you check the "Download all dives" option when downloading).
However, the matching dive is an *exact* match, which works well when
you have a single dive computer, but is a big pain when you have
multiple. What happens is that the date of the dive will be determined
by whatever dive computer you used first, and then downloading from
other dive computers will not match exactly, but will merge (if the
computers are within a minute of each other).
And that will continue to happen every time you try to download from
that other dive computer.
So use the same logic as for the automatic dive merging: consider
"within one minute" to be a matching dive. So don't download dives
that will be merged - unless the user asks for it.
We do want to have some way of saying "force download of all dives
from today" or something like that, I suspect. Because while I don't
want to re-download *every* dive, I might want to force-merge the last
<N> dives.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'libdivecomputer.c')
-rw-r--r-- | libdivecomputer.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libdivecomputer.c b/libdivecomputer.c index c4614812d..076126dfb 100644 --- a/libdivecomputer.c +++ b/libdivecomputer.c @@ -193,7 +193,9 @@ static int find_dive(struct dive *dive, device_data_t *devdata) for (i = 0; i < dive_table.preexisting; i++) { struct dive *old = dive_table.dives[i]; - if (dive->when != old->when) + if (dive->when > old->when + 60) + continue; + if (dive->when + 60 < old->when) continue; return 1; } |