title: time.h clock() broken on OS X?
body: <p>Am I going mad? I'm running this on x86_64.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;time.h&gt;
  #include &lt;unistd.h&gt;
  
  int main(int argc, char *argv[])
  {
      printf("Clock: %f\n", clock() / (double)CLOCKS_PER_SEC);
      sleep(1);
      printf("Clock: %f\n", clock() / (double)CLOCKS_PER_SEC);
      sleep(1);
      printf("Clock: %f\n", clock() / (double)CLOCKS_PER_SEC);
      return 0;
  }
  </code></pre>
  
  <p>This prints</p>
  
  <blockquote>
    <p>Clock: 0.002880<br>
    Clock: 0.002968<br>
    Clock: 0.003019</p>
  </blockquote>
  
  <p>It clearly waits for a second at the <code>sleep(1)</code> lines, but the output is clearly wrong.</p>
  
  <p>If that doesn't work, is there a portable C alternative?</p>