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) {
timeLeft = startTime - currentTime;
currentTimeInSeconds = timeLeft / 1000;
minutes = currentTimeInSeconds / 60;
remainingSeconds = currentTimeInSeconds % 60;
hours = minutes / 60;
minutes = minutes % 60;
if (controller != null) {
updateTime(String.format("Time until race starts: %02d:%02d:%02d", hours, minutes, remainingSeconds));
if (timeLeft == 0 && controller != null) {
updateTime("Race is starting...");
} else {
currentTimeInSeconds = timeLeft / 1000;
minutes = currentTimeInSeconds / 60;
remainingSeconds = currentTimeInSeconds % 60;
hours = minutes / 60;
minutes = minutes % 60;
if (controller != null) {
updateTime(String.format("Time until race starts: -%02d:%02d:%02d", hours, minutes, remainingSeconds));
}
}
try {
timeLoopEnded = System.currentTimeMillis();

Loading…
Cancel
Save