public static void ClockLoop(int duration) {
		// GUI_NB.GCO("Clock time is now " + DisplayTimeFull() + " with time rate " + ClockControl.PrintTimeScale());
						
		GlobalFuncs.ticksStable++;
		
		if (GlobalFuncs.runtoEq || GlobalFuncs.updateVapor) { 
			
			GlobalFuncs.maxDelta = 0;
			GlobalFuncs.scenMap.updateVaporSS();		// Calculates maximum DV at sources and sinks
			//GUI_NB.GCO("Num sources: " + GlobalFuncs.scenMap.vaporSourceList.size() + " and sinks: " + GlobalFuncs.scenMap.vaporSinkList.size());
			if (GlobalFuncs.fixSlowRate && GlobalFuncs.updateVapor && time % 100 == 1) GlobalFuncs.scenMap.UpdateExactDVNorm();
			GlobalFuncs.scenMap.recalcFlowRate();
			
			GlobalFuncs.scenMap.calcAllVapor();
			GlobalFuncs.scenMap.updateAllVapor();
			
			if (GlobalFuncs.runtoEq) {
				if (Math.abs(GlobalFuncs.totalVaporDelta) <= GlobalFuncs.dvTolerance && GlobalFuncs.ticksStable > 100) {
					ClockControl.SetTimeScale((byte) 4);
					if (!ClockControl.paused) ClockControl.Pause();
					GlobalFuncs.runtoEq = false;
					GUI_NB.GCODTG("Reached desired DV threshold.");
				}	
			}
			

			GlobalFuncs.gui.repaint();
		} else {		
			moveAllUnits(duration);
		}
		
		GlobalFuncs.gui.BasicInfoPane.repaint();
		
	}