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

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -