diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2020-09-08 20:21:44 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-09-15 08:47:51 -0700 |
commit | dbf7fa89a27d9a6a721eceb056209d9ec7b22dec (patch) | |
tree | df034caa4df2be393f79b450bca653da1cfde185 /xslt/shearwater.xslt | |
parent | 601f49ab8440cf08ba7dc97666bf34ab0b1d7210 (diff) | |
download | subsurface-dbf7fa89a27d9a6a721eceb056209d9ec7b22dec.tar.gz |
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>
Diffstat (limited to 'xslt/shearwater.xslt')
-rw-r--r-- | xslt/shearwater.xslt | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/xslt/shearwater.xslt b/xslt/shearwater.xslt index d29d7b02a..6093acb59 100644 --- a/xslt/shearwater.xslt +++ b/xslt/shearwater.xslt @@ -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 > 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> |