Cleanup: SegmentStatisticUpdater.

This commit is contained in:
Dennis Guse
2025-11-11 21:26:23 +01:00
committed by Dennis Guse
parent 8d015fee6c
commit 59ea50b96f
3 changed files with 32 additions and 13 deletions
@@ -218,10 +218,6 @@ public class SegmentStatisticUpdater {
);
}
public Instant getStartTime() {
return startTime;
}
/**
* Should only be called on start.
*/
@@ -247,9 +243,8 @@ public class SegmentStatisticUpdater {
totalDistance = totalDistance.plus(distance_m);
}
@VisibleForTesting
public void setTotalTime(Duration totalTime) {
this.totalTime = totalTime;
public void updateTotalTime(Instant now) {
this.totalTime = Duration.between(startTime, now);
}
public void addMovingTime(TrackPoint trackPoint, TrackPoint lastTrackPoint) {
@@ -111,7 +111,7 @@ public class TrackStatisticsUpdater {
// Always update time
currentSegment.setStopTime(trackPoint.getTime());
currentSegment.setTotalTime(Duration.between(currentSegment.getStartTime(), trackPoint.getTime()));
currentSegment.updateTotalTime(trackPoint.getTime());
// Process sensor data: barometer
if (trackPoint.hasAltitudeGainLoss()) {