From: Linus Torvalds Date: Fri, 2 Sep 2011 05:21:16 +0000 (-0700) Subject: Generate 'watertemp' field from samples if required X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=2cd2cafdf4fc1ea37872f172a62d3d38220adf64;p=ext%2Fsubsurface.git 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 --- 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++; }