title: C++: How to sleep for a nanosecond?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/85122/sleep-less-than-one-millisecond">Sleep Less Than One Millisecond</a>  </p>
  </blockquote>
  
  
  
  <p>How can I make a program sleep for a nanosecond? I searched the Internet, and I found several ways to sleep, but:<br>
  windows.h's <code>Sleep()</code> sleeps only for milliseconds.<br>
  <code>ctime</code>'s <code>nanosleep()</code> is only for POSIX systems, and I'm using Windows.<br>
  I also tried this:</p>
  
  <pre><code>int usleep(long usec)
  {
      struct timeval tv;
      tv.tv_sec = usec/1000000L;
      tv.tv_usec = usec%1000000L;
      return select(0, 0, 0, 0, &amp;tv);
  };
  </code></pre>
  
  <p>But Code::Blocks says:</p>
  
  <pre><code>obj\Release\main.o:main.cpp|| undefined reference to `select@20'|
  </code></pre>
  
  <p>I tried many things, but everything failed. What should I do?</p>