summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2016-04-02 14:13:17 +0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-02 06:31:22 -0500
commit916ed018301ad34d7e543a69de05da8d27205bfd (patch)
tree3b6069d9d786495676e20b8081f66ac380c033f5
parent3ba21027b91ca1cf85be73cfce42f433077b000f (diff)
downloadsubsurface-916ed018301ad34d7e543a69de05da8d27205bfd.tar.gz
SDM import: calculate duration if needed
Seems that DiveManager does not always return the dive duration in DIVETIMESEC field. In this case we can try to calculate the duration from sample count and interval. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--xslt/SuuntoSDM.xslt18
1 files changed, 14 insertions, 4 deletions
diff --git a/xslt/SuuntoSDM.xslt b/xslt/SuuntoSDM.xslt
index 3b41b7d41..90cc5fdc5 100644
--- a/xslt/SuuntoSDM.xslt
+++ b/xslt/SuuntoSDM.xslt
@@ -25,10 +25,20 @@
</xsl:attribute>
<xsl:attribute name="duration">
- <xsl:call-template name="timeConvert">
- <xsl:with-param name="timeSec" select="DIVETIMESEC"/>
- <xsl:with-param name="units" select="$units"/>
- </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="DIVETIMESEC != ''">
+ <xsl:call-template name="timeConvert">
+ <xsl:with-param name="timeSec" select="DIVETIMESEC"/>
+ <xsl:with-param name="units" select="$units"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="timeConvert">
+ <xsl:with-param name="timeSec" select="SAMPLECNT * SAMPLEINTERVAL"/>
+ <xsl:with-param name="units" select="$units"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:attribute>
<xsl:choose>