UPDATE: code now compiles properly
I would like to calculate the time difference between two timestamps. The resolution is important so it must be in microseconds/milliseconds.
I tried the following but the result is not meaningful:
boost::posix_time::ptime before = (&input[0])->timestamp;
boost::posix_time::ptime now = boost::posix_time::microsec_clock::local_time();
boost::posix_time::time_period tp (before, now);
std::string str (boost::posix_time::to_simple_string (tp));
cout << str.c_str() << endl;
The result i get is the following:
[2014-Jun-20 12:26:07.711182/2014-Jun-20 12:26:07.711596]
How can i get something like the following instead?
76 μs