0
how to determine the time of the program?
Hi. I want to calculate the time of the program. the result is 0. where is the error? https://code.sololearn.com/cJfvd4S1QgYI/?ref=app
5 Respuestas
+ 4
You are doing it correctly the first time, it works on windows.
The problem is that sololearn runs on linux and clock() doesn't play nice there for some reason.
It seems to always return 0, even on the linux build I have.
Check out https://linux.die.net/man/3/clock_gettime for linux instead.
Maybe https://en.cppreference.com/w/cpp/chrono
I'm not too experienced in linux so I can't really go deeper, sorry. :(
+ 2
Little edit: seems sololearn doesn't run on linux, appearently.
I still recommend that you use chrono though. :)
0
thank you very much for the information and links. I'll read.
0
OK, I will follow your advice. :-)
0
Bennet Post, Thank you for the information. I will read and understand.