public ZonedDateTime getTime ( ) { if ( null == time ) { ZonedDateTime now = ZonedDateTime . now ( ) ; time = new ObjectPropertyBase < ZonedDateTime > ( now ) { @ Override protected void invalidated ( ) { zoneId = get ( ) . getZone ( ) ; fireTileEvent ( RECALC_EVENT ) ; if ( ! isRunning ( ) && isAnimated ( ) ) { long animationDuration = getAnimationDuration ( ) ; timeline . stop ( ) ; final KeyValue KEY_VALUE = new KeyValue ( currentTime , now . toEpochSecond ( ) ) ; final KeyFrame KEY_FRAME = new KeyFrame ( javafx . util . Duration . millis ( animationDuration ) , KEY_VALUE ) ; timeline . getKeyFrames ( ) . setAll ( KEY_FRAME ) ; timeline . setOnFinished ( e -> fireTileEvent ( FINISHED_EVENT ) ) ; timeline . play ( ) ; } else { currentTime . set ( now . toEpochSecond ( ) ) ; fireTileEvent ( FINISHED_EVENT ) ; } } @ Override public Object getBean ( ) { return Tile . this ; } @ Override public String getName ( ) { return "time" ; } } ; } return time . get ( ) ; }
Returns the current time of the clock .