title: <time.h> clock() does not work properly
body: <p>I was trying to estimate the duration of a code block (particularly to get the time step of a physics-based animation for frame rate indepedency, so resolution should be in milliseconds grade). Questions here at stack overflow mostly recommend clock() method, I have tried it but it does not seem to work properly. I have solved the problem using gettimeoftheday() method, but still I'm curious as to why clock() fails. Here's my code block:</p>
  
  <pre><code>for (int i = 0; i &lt; 10000; i++)
  {
      std::cout &lt;&lt; "time: " &lt;&lt; clock() &lt;&lt; std::endl;
      usleep(1000);
  }
  </code></pre>
  
  <p>This prints time at a rate. When I increase the usleep value to, say 1000000, the increase rate of printed clock values drastically drop. I thought clock() should give a value related to an absolute time value, independent of my code. </p>
  
  <p>Thanks in advance.</p>
  
  <p>PS: To get a possible misunderstanding out of the way in advance, I'm not complaining the printing ratio has dropped. The VALUE printed at a certain delta time is not the same between usleep(1000) and usleep(1000000).</p>