aboutsummaryrefslogtreecommitdiffstats
path: root/xslt
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2012-11-26 20:57:05 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-11-26 11:14:58 -0800
commite544ca5f6a0c888a76dfb27c824712549fafe488 (patch)
treeed3731c1b47a9ac761666f5283f0fd39e024b531 /xslt
parentffa3fd551c2571060b5f41b7dedad3e714e33311 (diff)
downloadsubsurface-e544ca5f6a0c888a76dfb27c824712549fafe488.tar.gz
Handle seconds in decimal notation (from JDiveLog)
This is a hack to convert time stored in decimal notation to proper seconds. When using metric units the default way of JDiveLog to store seconds is to have the amount of seconds after decimal point (1.20 is 1 minute 20 seconds). In some odd case it is reportedly possible that the seconds are actually 100 based, thus we need to convert that to seconds (1.33333 will become 1 minute 20 seconds). Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'xslt')
-rw-r--r--xslt/jdivelog2subsurface.xslt9
1 files changed, 8 insertions, 1 deletions
diff --git a/xslt/jdivelog2subsurface.xslt b/xslt/jdivelog2subsurface.xslt
index 42cbec01e..74b6d0b99 100644
--- a/xslt/jdivelog2subsurface.xslt
+++ b/xslt/jdivelog2subsurface.xslt
@@ -348,7 +348,14 @@ Comment: <xsl:value-of select="Comment"/>
<xsl:value-of select="concat(floor(number($timeSec) div 60), ':', format-number(floor(number($timeSec) mod 60), '00'), ' min')"/>
</xsl:when>
<xsl:otherwise>
- <xsl:value-of select="concat(substring-before($timeSec, '.'), ':', format-number(substring-after($timeSec, '.'), '00'), ' min')"/>
+ <xsl:choose>
+ <xsl:when test="substring-after($timeSec, '.') >= 60">
+ <xsl:value-of select="concat(substring-before($timeSec, '.'), ':', round(substring-after(format-number($timeSec, '.00'), '.') * .6), ' min')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat(substring-before($timeSec, '.'), ':', format-number(substring-after($timeSec, '.'), '00'), ' min')"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:if>