Hi,
Is there any portable (Windows & Linux) way of counting how many milliseconds elapsed between two calls ?
Basically, I want to achieve the same functionnality than the StopWatch
class of .NET
. (for those who already used it)
In a perfect world, I would have used boost::date_time
but that's not an option here due to some silly rules I'm enforced to respect.
For those who better read code, this is what I'd like to achieve.
Timer timer;
timer.start();
// Some instructions here
timer.stop();
// Print out the elapsed time
std::cout << "Elapsed time: " << timer.milliseconds() << "ms" << std::endl;
So, if there is a portable (set of) function(s) that can help me implement the Timer
class, what is it ? If there is no such function, what Windows & Linux API should I use to achieve this functionnality ? (using #ifdef WINDOWS
-like macros)
Thanks !