From: Frédéric Perrin Date: Tue, 15 Dec 2020 22:51:13 +0000 (+0000) Subject: Fix times with holes X-Git-Tag: v20.1.fp2~2 X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=commitdiff_plain;h=f08ce2f01d168894308cc09f317c78b23477e5b7 Fix times with holes --- diff --git a/src/tim/prune/data/RangeStats.java b/src/tim/prune/data/RangeStats.java index d8461c4..1f57626 100644 --- a/src/tim/prune/data/RangeStats.java +++ b/src/tim/prune/data/RangeStats.java @@ -81,13 +81,10 @@ public class RangeStats if (_earliestTimestamp == null || currTstamp.isBefore(_earliestTimestamp)) { _earliestTimestamp = currTstamp; } - if (_latestTimestamp == null || currTstamp.isAfter(_latestTimestamp)) { - _latestTimestamp = currTstamp; - } // Work out duration without segment gaps - if (!inPoint.getSegmentStart() && _prevPoint != null && _prevPoint.hasTimestamp()) + if (!inPoint.getSegmentStart() && _latestTimestamp != null) { - long millisLater = currTstamp.getMillisecondsSince(_prevPoint.getTimestamp()); + long millisLater = currTstamp.getMillisecondsSince(_latestTimestamp); if (millisLater < 0) { _timesOutOfSequence = true; } @@ -95,6 +92,9 @@ public class RangeStats _movingMilliseconds += millisLater; } } + if (_latestTimestamp == null || currTstamp.isAfter(_latestTimestamp)) { + _latestTimestamp = currTstamp; + } } else { _timesIncomplete = true;