diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-24 16:50:21 -1000 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-11-25 13:04:59 -0800 |
commit | c019da8fd5e09ee9efd7f158c68e8afaf7140e56 (patch) | |
tree | 2d15c51bc8fab4e898d2b7268baa4844888a3744 /libdivecomputer.c | |
parent | 8d62f20aa0fccfe4ae6f0de6f5ccd1bcb0920075 (diff) | |
download | subsurface-c019da8fd5e09ee9efd7f158c68e8afaf7140e56.tar.gz |
Add basic divecomputer info setup with xml parsing and saving
This also knows how to save and restore multiple dive computers in the
XML data, but there's no way to actually *create* that kind of
information yet (nor do we display it). Tested by creating fake XML
files with multiple dive computers by hand so far.
The dive computer information right now contains (apart from the sample
and event data that we've always had):
- the vendor and product name of the dive computer
- the date of the dive according to the dive computer (so if you change
the dive date manually, the dive computer date stays around)
Note that if the dive computer date matches the dive date, we won't
bother saving the redundant information in the XML file.
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 27ce8458e..48680c7ce 100644 --- a/libdivecomputer.c +++ b/libdivecomputer.c @@ -242,6 +242,8 @@ static int dive_cb(const unsigned char *data, unsigned int size, dc_parser_destroy(parser); return rc; } + dive->dc.vendor = strdup(devdata->vendor); + dive->dc.product = strdup(devdata->product); tm.tm_year = dt.year; tm.tm_mon = dt.month-1; @@ -249,7 +251,7 @@ static int dive_cb(const unsigned char *data, unsigned int size, tm.tm_hour = dt.hour; tm.tm_min = dt.minute; tm.tm_sec = dt.second; - dive->when = utc_mktime(&tm); + dive->when = dive->dc.when = utc_mktime(&tm); // Parse the divetime. dev_info(devdata, _("Dive %d: %s %d %04d"), import_dive_number, |