@ -55,6 +55,24 @@ public class RaceClock {
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 .
* /
@ -68,6 +86,10 @@ public class RaceClock {
return zoneId . toString ( ) ;
}
public ZonedDateTime getTime ( ) {
return time ;
}
public StringProperty timeStringProperty ( ) {
return timeString ;
}