question: private void update ( ) { if ( isVisible ( ) ) { if ( ! loading && infoLastLoaded > 0 ) { long timePassed = System . currentTimeMillis ( ) - infoLastLoaded ; updated . setText ( "Info last loaded: " + DateTime . duration ( timePassed , 1 , 0 ) + " ago" + ( statusEdited ? " (edited)" : "" ) ) ; } if ( lastCommercialRun > 0 ) { long ago = System . currentTimeMillis ( ) - lastCommercialRun ; lastCommercialInfo . setText ( "Last run: " + DateTime . duration ( ago , 1 , 0 ) + " ago" ) ; lastCommercialInfo . setToolTipText ( "Last run: " + DateTime . formatFullDatetime ( lastCommercialRun ) ) ; } if ( loading && lastPutResult > 0 ) { long ago = System . currentTimeMillis ( ) - lastPutResult ; if ( ago > PUT_RESULT_DELAY ) { setLoading ( false ) ; } } finishDialog ( ) ; } if ( scheduledCommercialTime > 0 ) { long timeLeft = scheduledCommercialTime - System . currentTimeMillis ( ) ; if ( timeLeft <= 0 ) { runCommercialNow ( scheduledCommercialLength ) ; } else if ( System . currentTimeMillis ( ) - lastCommercialRunAttempt > COMMERCIAL_RUN_ATTEMPT_DELAY ) { setCommercialResult ( String . format ( "Commercial (%ds) scheduled to run in %s" , scheduledCommercialLength , DateTime . duration ( timeLeft , 2 , 0 ) ) ) ; } } }
target:  Updates times and runs scheduled commercials.