Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] timing for geeks



On 12/3/05, Jim <jep200404@example.com> wrote:

> Of course, even if it is monotonic, you should avoid using ftime.

Yeah, use gettimeofday(2) instead:

#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>

int main(int argc,char *argv[])
{
   struct timeval start;

   for (;;) {
      gettimeofday(&start, NULL);
      printf("%d.%03ld \t \n",(int)start.tv_sec,start.tv_usec*1000);
   }

   return 0;
}

-Josh

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links