Does anyone know if there is a good way to turn a boost::posix_time::ptime
into an __int64
value. (I have compiled the microsecond version, not th
#include
// ...
uint64_t secondsSinceEpoch(const boost::posix_time::ptime& time) {
namespace bpt = boost::posix_time;
const bpt::ptime epoch = bpt::from_time_t(0);
bpt::time_duration duration = time - epoch;
return duration.total_seconds();
}
// ...
namespace bpt = boost::posix_time;
const bpt::ptime now = bpt::second_clock::local_time();
uint64_t seconds = secondsSinceEpoch(now);
std::cout << "seconds: " << seconds << std::endl;