mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
git load: initialize dive computer timestamp and duration from dive
We don't save the dive computer timestamp and duration if they match the dive timestamp and duration. But that means that on loading, we need to default the dive computer time/duration to the dive one. If they differ, the loading of the divecomputer file will then override the default timestamp/duration. This mainly matters if a later dive merge then changes the timestamp of the dive: the dive computer timestamp needs to have been set correctly and not change. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a8fbd3d283
commit
4f29a47afb
1 changed files with 6 additions and 4 deletions
10
load-git.c
10
load-git.c
|
@ -1115,11 +1115,13 @@ static struct divecomputer *create_new_dc(struct dive *dive)
|
||||||
/* Did we already fill that in? */
|
/* Did we already fill that in? */
|
||||||
if (dc->samples || dc->model || dc->when) {
|
if (dc->samples || dc->model || dc->when) {
|
||||||
struct divecomputer *newdc = calloc(1, sizeof(*newdc));
|
struct divecomputer *newdc = calloc(1, sizeof(*newdc));
|
||||||
if (newdc) {
|
if (!newdc)
|
||||||
dc->next = newdc;
|
return NULL;
|
||||||
dc = newdc;
|
dc->next = newdc;
|
||||||
}
|
dc = newdc;
|
||||||
}
|
}
|
||||||
|
dc->when = dive->when;
|
||||||
|
dc->duration = dive->duration;
|
||||||
return dc;
|
return dc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue