Changed race clock to display negative time before race

#story[16] #implement
main
Erika Savell 9 years ago
parent 7a13885064
commit e923fe671b

@ -114,13 +114,17 @@ public abstract class Race implements Runnable {
while (currentTime <= startTime) { while (currentTime <= startTime) {
timeLeft = startTime - currentTime; timeLeft = startTime - currentTime;
currentTimeInSeconds = timeLeft / 1000; if (timeLeft == 0 && controller != null) {
minutes = currentTimeInSeconds / 60; updateTime("Race is starting...");
remainingSeconds = currentTimeInSeconds % 60; } else {
hours = minutes / 60; currentTimeInSeconds = timeLeft / 1000;
minutes = minutes % 60; minutes = currentTimeInSeconds / 60;
if (controller != null) { remainingSeconds = currentTimeInSeconds % 60;
updateTime(String.format("Time until race starts: %02d:%02d:%02d", hours, minutes, remainingSeconds)); hours = minutes / 60;
minutes = minutes % 60;
if (controller != null) {
updateTime(String.format("Time until race starts: -%02d:%02d:%02d", hours, minutes, remainingSeconds));
}
} }
try { try {
timeLoopEnded = System.currentTimeMillis(); timeLoopEnded = System.currentTimeMillis();

Loading…
Cancel
Save