1#include <vanetza/common/clock.hpp>
2#include <boost/date_time/posix_time/posix_time.hpp>
7const boost::posix_time::ptime& Clock::epoch()
9 static const boost::posix_time::ptime epoch {
10 boost::gregorian::date(2004, 1, 1),
11 boost::posix_time::milliseconds(0)
16Clock::time_point Clock::at(
const boost::posix_time::ptime& t)
18 auto delta = (t - epoch()).total_microseconds();
19 Clock::time_point tp { std::chrono::microseconds(delta) };
23Clock::date_time Clock::at(
const Clock::time_point& t)
25 std::chrono::microseconds delta = t.time_since_epoch();
26 return Clock::epoch() + boost::posix_time::microseconds(delta.count());
29Clock::time_point Clock::at(
const std::string& at)
31 return Clock::at(boost::posix_time::time_from_string(at));