c++11 - Convert chrono duration to time_point -
how can convert chrono duration time_point, later clock's epoch given duration? tried find epoch time in chrono clock without success.
from synopsis in 20.12.6 [time.point]:
template <class clock, class duration = typename clock::duration> class time_point { public: constexpr explicit time_point(const duration& d); // same time_point() + d
this can used (for example) like:
using namespace std::chrono; system_clock::time_point tp{30min}; // needs c++14 literal
though system_clock::time_point not specified in standard, in practice creates time_point
referring 1970-01-01 00:30:00 utc.
Comments
Post a Comment