+ 2
How to calculate total code compilation time in C?
I was trying to find out how much time it needed for a code written in C to compile and run. I have tried a function called clock () from time.h library. But I always get 0.0000000 second output. I think it should something like ms. Please see my code. Help me to get the output of code run time. https://code.sololearn.com/cmg0K6Ah54km/?ref=app
3 Réponses
+ 4
I'm guessing they stubbed the library code with return 0.0
+ 3
This works for me:
double time_spent = ((double)end-begin)/CLOCKS_PER_SEC;
printf ("\n\nTotal run time: %.20f",time_spent );
But not in the Code Playground on SoloLearn. I compiled it on the command-line.
Code Playground always returns 0. There could well be a bug there, it might be worth reporting it to the SL team.
+ 1
John Wells Can you please look at this issue?