Merge branch 'splitIntoTwoModules' of https://eng-git.canterbury.ac.nz/seng302-2017/team-7 into splitIntoTwoModules

main
Erika Savell 9 years ago
commit d38baa9fc4

@ -55,6 +55,24 @@ public class RaceClock {
this.lastTime = System.currentTimeMillis(); this.lastTime = System.currentTimeMillis();
} }
/**
* Sets time to given UTC time in seconds from Unix epoch, preserving timezone.
* @param time UTC time
*/
public void setUTCTime(long time) {
Date utcTime = new Date(time);
setTime(utcTime.toInstant().atZone(this.zoneId));
}
/**
* Get ZonedDateTime corresponding to local time zone and given UTC time.
* @param time
*/
public ZonedDateTime getLocalTime(long time) {
Date utcTime = new Date(time);
return utcTime.toInstant().atZone(this.zoneId);
}
/** /**
* Updates time by duration elapsed since last update. * Updates time by duration elapsed since last update.
*/ */
@ -68,6 +86,10 @@ public class RaceClock {
return zoneId.toString(); return zoneId.toString();
} }
public ZonedDateTime getTime() {
return time;
}
public StringProperty timeStringProperty() { public StringProperty timeStringProperty() {
return timeString; return timeString;
} }

@ -148,6 +148,9 @@ public class VisualiserInput implements Runnable
* @throws IOException * @throws IOException
*/ */
private static byte[] getBytes(InputStream inStream) throws IOException { private static byte[] getBytes(InputStream inStream) throws IOException {
while (inStream.available() < 15){
//WE NEED THIS!!!!
}
byte[] headerBytes = new byte[15]; byte[] headerBytes = new byte[15];
inStream.read(headerBytes); inStream.read(headerBytes);
byte[] messageLenBytes = Arrays.copyOfRange(headerBytes, 13, 15); byte[] messageLenBytes = Arrays.copyOfRange(headerBytes, 13, 15);

Loading…
Cancel
Save