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>
This commit is contained in:
Miika Turkia 2012-11-26 20:57:05 +02:00 committed by Dirk Hohndel
parent ffa3fd551c
commit e544ca5f6a

View file

@ -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>