I am using boost 1.46 which does not include boost::timer, What other way can I time my functions.
I am currently doing this:
time_t now = time(0); <some stuff> time_t after = time(0); cout << after - now << endl;
but it just gives the answer in seconds, so if the function takes < 1s it displays 0.
Thanks
In linux or Windows:
#include <ctime> #include <iostream> int main(int, const char**) { std::clock_t start; start = std::clock(); // your test std::cout << "Time: " << (std::clock() - start) / (double)(CLOCKS_PER_SEC / 1000) << " ms" << std::endl; return 0; }
Good Luck ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With