use Duration instead of millis for readability

Change-Id: I216c61a034ac0d1dbb3fff55d8c3c302c49dfab9
This commit is contained in:
Axel Uhl
2016-06-29 09:41:23 +02:00
parent 7da10f65c1
commit 608c060894
@@ -81,8 +81,8 @@ import com.sap.sse.gwt.dispatch.shared.commands.DTO;
@GwtIncompatible
public class RaceContext {
private static final Logger logger = Logger.getLogger(RaceContext.class.getName());
private static final long TIME_BEFORE_START_TO_SHOW_RACES_AS_LIVE = 60 * 60 * 1000; // 1 hour
private static final long TIME_TO_SHOW_CANCELED_RACES_AS_LIVE = 5 * 60 * 1000; // 5 min
private static final Duration TIME_BEFORE_START_TO_SHOW_RACES_AS_LIVE = Duration.ONE_HOUR;
private static final Duration TIME_TO_SHOW_CANCELED_RACES_AS_LIVE = Duration.ONE_MINUTE.times(5);
private final TimePoint now = MillisecondsTimePoint.now();
private final LeaderboardContext leaderboardContext;
private final Leaderboard leaderboard;
@@ -541,7 +541,7 @@ public class RaceContext {
RaceLogFlagEvent abortingFlagEvent = checkForAbortFlagEvent();
if (abortingFlagEvent != null) {
TimePoint abortingTimeInPassBefore = abortingFlagEvent.getLogicalTimePoint();
if (now.minus(abortingTimeInPassBefore.asMillis()).asMillis() < TIME_TO_SHOW_CANCELED_RACES_AS_LIVE) {
if (abortingTimeInPassBefore.until(now).compareTo(TIME_TO_SHOW_CANCELED_RACES_AS_LIVE) < 0) {
result = true;
// TODO: Problem: This causes the race added to the live races list without having a start time!!!
// This does not work right now -> consider using a start time of the last pass.