title: C++ count delay time?
body: <p>I want to make a scheduler, so I write looping with sleep every one usecond, but when I test the scheduler, the event is not called in the defined time.</p>
  
  <p>I try to make it simple to verify the logic, but somehow the print is not really called in the defined time. I purpose to 1 second with <code>usecond(1)*1000000;</code></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;unistd.h&gt;
  
  using namespace std;
  
  int main() {
    unsigned int delay = 0;
    for (;;) {
      usleep(1);
      delay++;
      if (delay &gt;= 1000000) {
        cout &lt;&lt; "TICK\n" &lt;&lt; flush;
      }
    }
  }
  </code></pre>
  
  <p>Result appears on 1 minute.</p>