summaryrefslogtreecommitdiffstats
path: root/core/save-xml.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2020-05-14 09:48:09 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2020-05-14 13:27:07 -0700
commit62e95fdc8656a0c8fdb181c3fe0a48e043650a05 (patch)
tree0d55fe8d5ab4b93f389e7bb13e22a92aa2cdf3fc /core/save-xml.c
parent1f942ab556646fdfc7e5a5634cc6fd15518bc709 (diff)
downloadsubsurface-62e95fdc8656a0c8fdb181c3fe0a48e043650a05.tar.gz
Save SAC, OTU and CNS in the XML export
We do _not_ read them back, since they are calculated values, although I guess we could aim to do that too at some point in case we have an import from somewhere else that has these values but not the profile (or gas use) to actually calculate them. Fix test-cases that are checked by TestParse (but nothing else) to match. Requested-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'core/save-xml.c')
-rw-r--r--core/save-xml.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/core/save-xml.c b/core/save-xml.c
index 8e3d212eb..54469a1cf 100644
--- a/core/save-xml.c
+++ b/core/save-xml.c
@@ -502,6 +502,16 @@ void save_one_dive_to_mb(struct membuffer *b, struct dive *dive, bool anonymize)
put_format(b, " chill='%d'", dive->chill);
if (dive->invalid)
put_format(b, " invalid='1'");
+
+ // These three are calculated, and not read when loading.
+ // But saving them into the XML is useful for data export.
+ if (dive->sac > 100)
+ put_format(b, " sac='%d.%03d l/min'", FRACTION(dive->sac, 1000));
+ if (dive->otu)
+ put_format(b, " otu='%d'", dive->otu);
+ if (dive->maxcns)
+ put_format(b, " cns='%d%%'", dive->maxcns);
+
save_tags(b, dive->tag_list);
if (dive->dive_site)
put_format(b, " divesiteid='%8x'", dive->dive_site->uuid);