0

I use this code for measuring computing time of my C program:

clock_t start = clock() ;
do_some_work() ;
clock_t end = clock() ;
double elapsed_time = (end-start)/(double)CLOCKS_PER_SEC ;

Problem is, that this double elapsed_time returns only number with 2 decimal positions, like 1,78 seconds, but I want to enlarge it to 6 decimal positions. Is there any way how to do it?

Thanks

Waypoint
  • 17,283
  • 39
  • 116
  • 170

1 Answers1

2

see c-timer-function-to-provide-time-in-nano-seconds

Community
  • 1
  • 1
dubnde
  • 4,359
  • 9
  • 43
  • 63