For periodic task, set the next time based on current total time

rather than track start time. The current total time would
take into account pause/resume time.
This commit is contained in:
Jimmy Shih
2012-08-27 12:17:23 -07:00
parent 296cd81167
commit 25778911c9
@@ -72,11 +72,7 @@ public class TimerTaskExecutor {
return;
}
long now = System.currentTimeMillis();
long next = tripStatistics.getStartTime();
if (next < now) {
next = now + interval - ((now - next) % interval);
}
long next = System.currentTimeMillis() + interval - (tripStatistics.getTotalTime() % interval);
timer.scheduleAtFixedRate(new PeriodicTimerTask(), new Date(next), interval);
}