From 2cd2cafdf4fc1ea37872f172a62d3d38220adf64 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Thu, 1 Sep 2011 22:21:16 -0700 Subject: [PATCH] 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 --- parse-xml.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/parse-xml.c b/parse-xml.c index 86ef31a..dfe6a61 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++; } -- 2.45.2