 <p>Something like that should do the trick, even though your attempt seems correct in the first place :</p> <pre><code>typedef std::chrono::high_resolution_clock Clock; typedef std::chrono::milliseconds Milliseconds; Clock::time_point t0 = Clock::now(); // DO A LOTS OF THINGS HERE..... Clock::time_point t1 = Clock::now(); auto elapsed_time = std::chrono::duration_cast&lt;Milliseconds&gt;(t1 - t0); auto duration = Milliseconds(2000); // Check if time left from initial 2 seconds wait the difference if (elapsed_time &lt; duration) { std::this_thread::sleep_for(duration - elapsed_time); } </code></pre>