summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-01 22:21:16 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-01 22:21:16 -0700
commit2cd2cafdf4fc1ea37872f172a62d3d38220adf64 (patch)
tree7b8a4d26d7b4169a3c09074afaefa8b6aafc10ac
parentf7fb74f3a78b4fbf561eb91548cf3e355af9b8b1 (diff)
downloadsubsurface-2cd2cafdf4fc1ea37872f172a62d3d38220adf64.tar.gz
Generate 'watertemp' field from samples if required
Sure, it's redundant, but it's convenient for the general dive info. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--parse-xml.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/parse-xml.c b/parse-xml.c
index 86ef31ade..dfe6a616e 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -600,6 +600,11 @@ static void sample_end(void)
if (sample->depth.mm > dive->maxdepth.mm)
dive->maxdepth.mm = sample->depth.mm;
+ if (sample->temperature.mkelvin) {
+ if (!dive->watertemp.mkelvin || dive->watertemp.mkelvin > sample->temperature.mkelvin)
+ dive->watertemp = sample->temperature;
+ }
+
sample = NULL;
dive->samples++;
}