]> gitweb.fperrin.net Git - GpsPrune.git/commitdiff
Fix times with holes
authorFrédéric Perrin <fred@fperrin.net>
Tue, 15 Dec 2020 22:51:13 +0000 (22:51 +0000)
committerFrédéric Perrin <fred@fperrin.net>
Tue, 15 Dec 2020 22:51:13 +0000 (22:51 +0000)
src/tim/prune/data/RangeStats.java

index d8461c476b122a58561d215296b1fe7370aef74b..1f5762618640a9df97bb63fd50ea0877efb0dc5a 100644 (file)
@@ -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;