AnsweredAssumed Answered

work with volatile clock_t

Question asked by Milos on Jan 20, 2012
Latest reply on Jan 26, 2012 by CraigG



I would like to print time of function


I'm working with


volatile clock_t clock_start=0;
volatile clock_t clock_stop=0;
volatile clock_t clock_diff;
double tics = 0;




       clock_start  = clock();

        function (); // some

        clock_stop = clock();
        clock_diff = ( (clock_stop - clock_start)) ;
        tics= ((double) clock_diff/CLOCKS_PER_SEC);

        printf("Time taken is %g seconds\n",(tics));


            for short time it is working

but NOT if it takes more seconds.


Can you help me?


Best Regards,