For simple C cmd programs: how to add "program executed in 12,345 seconds" ?
- by WoodsieLord
I'm a windows user, and I'm learning C. I use Codeblocks and visual c++ 2008 express at home to write simple C command line programs (I'm a beginner) and I find really useful when codeblocks adds a few lines at the end with the time it takes (example: "Process returned 0 (0x0) execution time : 6.848 s").
I want to add this functionality to the .exe so I can 'benchmark' or 'test' the program on a few computers.
I tried using time(NULL) but it only works with 1 second precision.
I also found very interesting answers here (I'm actually looking for the same thing): http://stackoverflow.com/questions/2173323/calculating-time-by-the-c-code
The solution proposed by Mark Wilkins, works fine on visual c++ 2008 express on my windows 64 bit PC, but the .exe does not work anywhere else. Am I doing something wrong?
I would like a method to count elapsed wall time for my programs, that must have 32bit compatibility.
Thanks in advance!