private void validateAndSetClock ( long newSimulationTime ) { // We do not use the getClock routine here as // the Engine and JobTracker clocks are different at // this point. long currentSimulationTime = clock . getTime ( ) ; if ( newSimulationTime < currentSimulationTime ) { // time has gone backwards throw new IllegalArgumentException ( "Time has gone backwards! " + "newSimulationTime: " + newSimulationTime + " while currentTime: " + currentSimulationTime ) ; } // the simulation time should also match that in the engine assert ( newSimulationTime == engine . getCurrentTime ( ) ) : " newTime =" + newSimulationTime + " engineTime = " + engine . getCurrentTime ( ) ; // set the current simulation time clock . setTime ( newSimulationTime ) ; }
Utility to validate the current simulation time