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

4th Feb 2019, 8:22 AM
Kirill Shlenkin
Kirill Shlenkin - avatar
5 Respostas
+ 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. :(
4th Feb 2019, 9:27 AM
Dennis
Dennis - avatar
+ 2
Little edit: seems sololearn doesn't run on linux, appearently. I still recommend that you use chrono though. :)
4th Feb 2019, 12:35 PM
Dennis
Dennis - avatar
0
thank you very much for the information and links. I'll read.
4th Feb 2019, 12:30 PM
Kirill Shlenkin
Kirill Shlenkin - avatar
0
OK, I will follow your advice. :-)
4th Feb 2019, 1:10 PM
Kirill Shlenkin
Kirill Shlenkin - avatar
0
Bennet Post, Thank you for the information. I will read and understand.
4th Feb 2019, 1:28 PM
Kirill Shlenkin
Kirill Shlenkin - avatar