I am having some problem by reading out the system time under Ubuntu. I am trying to get the difference of two ptime variables.
This is my declaration:
#include "boost/date_time/posix_time/posix_time.hpp"
boost::posix_time::ptime now = boost::posix_time::microsec_clock::universal_time();
boost::posix_time::ptime last_time = now;
boost::posix_time::time_duration dt;
...
After a time I update the now variable and build the difference
now = boost::posix_time::second_clock::universal_time();
dt = last_time - now;
The problem is that I want to work in millisecond resolution in my project so I divide the time I get by 1000 (after converting the time to microseconds like below).
printf("%f", (double)dt.total_microseconds());
The problem is that I only got values in second resolution. I already tried local_time() instead of universal_time(). It did not solved my problem...
Does any of you have any suggestions?
Thank you for the help.