title: Using CLOCK_PROCESS_CPUTIME_ID in clock_gettime
body: <p>I read <a href="http://linux.die.net/man/3/clock_gettime" rel="nofollow">http://linux.die.net/man/3/clock_gettime</a> and <a href="http://www.guyrutenberg.com/2007/09/22/profiling-code-using-clock_gettime/comment-page-1/#comment-681578" rel="nofollow">http://www.guyrutenberg.com/2007/09/22/profiling-code-using-clock_gettime/comment-page-1/#comment-681578</a>    </p>
  
  <p>It said to use this to </p>
  
  <pre><code>clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &amp;stop_time);
  </code></pre>
  
  <p>measure how long it take for a function to run.</p>
  
  <p>I tried that in my program. When I run it, it returns saying it took 15 sec. But when I compare against using a stop watch to measure it, it is 30 sec.</p>
  
  <p>Can you please tell me why clock_gettime return 1/2 of the actual time it took?</p>
  
  <p>Thank you.</p>