mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
8d62f20aa0
commit
c019da8fd5
4 changed files with 115 additions and 19 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue