File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -191,8 +191,8 @@ void WbSimulationWorld::step() {
191191 // How long should we have slept to be in real-time?
192192 double idealSleepTime = timeStep - (elapsed - mSleepRealTime );
193193 // Limit to timeStep to avoid weird behavior on large pauses (e.g., on startup)
194- if (idealSleepTime > timeStep)
195- idealSleepTime = timeStep;
194+ // We also can't wait less than 0 ms.
195+ idealSleepTime = qBound ( 0.0 , idealSleepTime, timeStep) ;
196196 // computing the mean of an history of several time values
197197 // improves significantly the stability of the algorithm.
198198 // Moreover it improves the stability of simulations where
@@ -205,8 +205,6 @@ void WbSimulationWorld::step() {
205205 mean += v;
206206 mean /= mIdealSleepTimeHistory .size ();
207207 mSleepRealTime = mean;
208- if (mSleepRealTime < 0.0 )
209- mSleepRealTime = 0.0 ;
210208
211209 mTimer ->start (mSleepRealTime );
212210 }
You can’t perform that action at this time.
0 commit comments