[c++] How to calculate a time difference in C++

For me, the most easy way is:

#include <boost/timer.hpp>

boost::timer t;
double duration;

t.restart();
/* DO SOMETHING HERE... */
duration = t.elapsed();

t.restart();
/* DO OTHER STUFF HERE... */
duration = t.elapsed();

using this piece of code you don't have to do the classic end - start.

Enjoy your favorite approach.