Created
May 13, 2013 06:09
-
-
Save Answeror/5566446 to your computer and use it in GitHub Desktop.
Get total seconds since 1970-01-01, millisecond precision.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/date_time/posix_time/posix_time.hpp> | |
double current_time() | |
{ | |
using namespace boost::gregorian; | |
using namespace boost::posix_time; | |
const boost::posix_time::ptime now = boost::posix_time::microsec_clock::local_time(); | |
ptime time_t_epoch(date(1970,1,1)); | |
time_duration diff = now - time_t_epoch; | |
return diff.total_milliseconds() / 1000.0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment