mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Actually create a UUID when creating a dive site during download
The existing code creates a deterministic ID (not exactly "unique") in order to help us avoid merge conflicts in git-storage mode. But as a side effect, if we re-download the same dive twice from a dive computer that supports GPS (right now only the Garmin Descent Mk1) we are guaranteed to create the same dive site uuid when we do this. So when we download a dive - whether we will actually *use* that dive later or not - we will be filling in the dive site information with the data we got from the dive computer. ... and in the process we will be overwriting any data that was filled in manually. The name of the dive site, but also possibly even the GPS of the dive site (maybe the user decided to edit that using the map, because while the automatically downloaded GPS data was "correct", maybe the user wanted to change it to be the actual under-water location using the satellite data, rather than the place where you started the dive or where you surfaced). In order to avoid this collision, this patch just makes the libdivecomputer download not use the dive time, but "time of download" for the dive site time, and thus effectively generate a new uuid for every download. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1a7d9881af
commit
d2b8088cd8
1 changed files with 2 additions and 1 deletions
|
@ -12,6 +12,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include "gettext.h"
|
||||
#include "dive.h"
|
||||
#include "subsurface-string.h"
|
||||
|
@ -615,7 +616,7 @@ static void parse_string_field(struct dive *dive, dc_field_string_t *str)
|
|||
longitude = parse_degrees(line, &line);
|
||||
|
||||
if (latitude.udeg && longitude.udeg)
|
||||
dive->dive_site_uuid = create_dive_site_with_gps(str->value, latitude, longitude, dive->when);
|
||||
dive->dive_site_uuid = create_dive_site_with_gps(str->value, latitude, longitude, time(NULL));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue