Changed race clock to display negative time before race

#story[16] #implement
This commit is contained in:
Erika Savell
2017-03-25 17:34:39 +13:00
parent 7a13885064
commit e923fe671b
+5 -1
View File
@@ -114,13 +114,17 @@ public abstract class Race implements Runnable {
while (currentTime <= startTime) { while (currentTime <= startTime) {
timeLeft = startTime - currentTime; timeLeft = startTime - currentTime;
if (timeLeft == 0 && controller != null) {
updateTime("Race is starting...");
} else {
currentTimeInSeconds = timeLeft / 1000; currentTimeInSeconds = timeLeft / 1000;
minutes = currentTimeInSeconds / 60; minutes = currentTimeInSeconds / 60;
remainingSeconds = currentTimeInSeconds % 60; remainingSeconds = currentTimeInSeconds % 60;
hours = minutes / 60; hours = minutes / 60;
minutes = minutes % 60; minutes = minutes % 60;
if (controller != null) { if (controller != null) {
updateTime(String.format("Time until race starts: %02d:%02d:%02d", hours, minutes, remainingSeconds)); updateTime(String.format("Time until race starts: -%02d:%02d:%02d", hours, minutes, remainingSeconds));
}
} }
try { try {
timeLoopEnded = System.currentTimeMillis(); timeLoopEnded = System.currentTimeMillis();