title: elapsed time in C
body: <pre><code>#include &lt;time.h&gt; 
  time_t start,end; 
  time (&amp;start);
  //code here
  time (&amp;end); 
  double dif = difftime (end,start); 
  printf ("Elasped time is %.2lf seconds.", dif ); 
  </code></pre>
  
  <p>I'm getting 0.000 for both start and end times. I'm not understanding the source of error.</p>
  
  <p>Also is it better to use time(start) and time(end) or start=clock() and end=clock() for computing the elapsed time.</p>