summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-23 11:53:42 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-23 11:53:42 -0800
commitc521aec88452460cc139d9d74d1f23ef58eac1a6 (patch)
tree819396ee40b8ca251f854560c22b1f10c67b855c /dive.c
parentb1db60ba4795638192c0dea93670d858d4178528 (diff)
downloadsubsurface-c521aec88452460cc139d9d74d1f23ef58eac1a6.tar.gz
Import and merge GPS data from the webservice
Dive locations marked (and named) via the companion app are downloaded from the webservice, parsed and merged with the existing dives. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/dive.c b/dive.c
index fe9ce3a20..db8ebda9d 100644
--- a/dive.c
+++ b/dive.c
@@ -1209,12 +1209,17 @@ 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 */
+ if ((!a->maxdepth.mm && !a->duration.seconds) ||
+ (!b->maxdepth.mm && !b->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()'