Merge remote-tracking branch 'origin/splitIntoTwoModules' into splitIntoTwoModules

This commit is contained in:
Joseph Gardner
2017-05-04 12:11:47 +12:00
2 changed files with 25 additions and 0 deletions
@@ -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);