I am trying to develop a simulation and the main thread should wait exactly 40ms in each iteration, because simulation is run with 25fps. In this 40ms, some process time is