summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-24 12:05:16 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-24 12:05:16 -0800
commit100c4008099615b3db492a5da793c4d21641d1cb (patch)
treeedbd589b316b696ff6f41fb5b56ca5d5955b3c19 /dive.c
parentd1262848d80d325605b5720961885f452426fb48 (diff)
parentc521aec88452460cc139d9d74d1f23ef58eac1a6 (diff)
downloadsubsurface-100c4008099615b3db492a5da793c4d21641d1cb.tar.gz
Merge branch 'webservice-import'
Update maxdepth / duration that have moved into the divecomputer structure. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/dive.c b/dive.c
index c7d4d3dce..f6807f3e6 100644
--- a/dive.c
+++ b/dive.c
@@ -1206,12 +1206,19 @@ static int max_time(duration_t a, duration_t b)
*/
static int likely_same_dive(struct dive *a, struct dive *b)
{
- int fuzz, match;
+ int match, fuzz = 20 * 60;
/* Don't try to merge dives in different trips */
if (a->divetrip && b->divetrip && a->divetrip != b->divetrip)
return 0;
+ /* if one of the dives has no depth and duration this could be
+ * a location marker from the webservice (in this situation it
+ * is valid to only check the first dc structure as we know that
+ * a location marker will only ever have one of those structures) */
+ if ((!a->dc.maxdepth.mm && !a->dc.duration.seconds) ||
+ (!b->dc.maxdepth.mm && !b->dc.duration.seconds))
+ return ((a->when <= b->when + fuzz) && (a->when >= b->when - fuzz));
/*
* Do some basic sanity testing of the values we
* have filled in during 'fixup_dive()'