Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calculating the total time for which program ran in c

Tags:

c

linux

I have a program in c which runs forever until I press CTRL+C. After the termination I need to show the total time for which the program ran. What to do so as to find the total time for which the program ran? if there is a code for it then please let me know. Thanks

like image 498
lolly pop Avatar asked Mar 18 '23 19:03

lolly pop


1 Answers

Yes, there is a program called time.

Run

time ./program
like image 130
Grzegorz Żur Avatar answered Mar 26 '23 03:03

Grzegorz Żur