Shearwater cloud import: adjust to milliseconds

Seems that Shearwater cloud gives the sample time in milliseconds
nowadays. Taking a wild guess, that this logic should suffice for us to
be able to import old and newer XML logs. (Assuming that if the
timestamp for the first sample is more than 100, timestamps are in
milliseconds, otherwise in seconds.)

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
Miika Turkia 2020-09-08 20:21:44 +03:00 committed by Dirk Hohndel
parent 601f49ab84
commit dbf7fa89a2

View file

@ -60,6 +60,17 @@
<xsl:value-of select="concat(maxTime, ' min')"/>
</xsl:attribute>
<xsl:variable name="timeMultiplier">
<xsl:choose>
<xsl:when test="diveLogRecords/diveLogRecord[1]/currentTime &gt; 100">
<xsl:value-of select="'1000'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'1'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<depth>
<xsl:attribute name="max">
<xsl:choose>
@ -122,7 +133,7 @@
<xsl:attribute name="time">
<xsl:call-template name="sec2time">
<xsl:with-param name="timeSec">
<xsl:value-of select="currentTime"/>
<xsl:value-of select="currentTime div $timeMultiplier"/>
</xsl:with-param>
</xsl:call-template>
</xsl:attribute>
@ -141,7 +152,7 @@
<xsl:attribute name="time">
<xsl:call-template name="sec2time">
<xsl:with-param name="timeSec">
<xsl:value-of select="currentTime"/>
<xsl:value-of select="currentTime div $timeMultiplier"/>
</xsl:with-param>
</xsl:call-template>
</xsl:attribute>