]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Generate 'watertemp' field from samples if required
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 2 Sep 2011 05:21:16 +0000 (22:21 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 2 Sep 2011 05:21:16 +0000 (22:21 -0700)
Sure, it's redundant, but it's convenient for the general dive info.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
parse-xml.c

index 86ef31ade91369ba0a1f3750acf03e49097dbaee..dfe6a616e6e9042152fccc59ac61fcad35dab141 100644 (file)
@@ -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++;
 }