54 template <
typename CLOCK>
57 return std::chrono::time_point_cast<GeneratedTime::duration>(t0 - CLOCK::now() + GeneratedTime::clock::now());
63 template <
typename CLOCK>
66 return std::chrono::time_point_cast<typename CLOCK::duration>(t0 - GeneratedTime::clock::now() + CLOCK::now());
72 template <
typename CLOCK>
75 auto t0 = CLOCK::from_time_t(epoch);
76 return convertTime<CLOCK>(t0);
84 return convertTime<std::chrono::system_clock>(epoch);
90 template <
typename CLOCK>
93 return CLOCK::to_time_t(convertTime<CLOCK>(t));
101 return toStandardTime<std::chrono::system_clock>(t);
109 std::time_t tt = toStandardTime<std::chrono::system_clock>(t);
111 strftime(buff, 20,
"%Y-%m-%d %H:%M:%S", localtime(&tt));
112 return std::string(buff);
long int toEpoch(const GeneratedTime &t)
Convert a GeneratedTime to an integral epoch (using system_clock)
std::time_t toStandardTime(const GeneratedTime &t)
Convert a GeneratedTime to a std::time_t (using system_clock)
GeneratedTime fromEpoch(long int epoch)
Convert an integral epoch to GeneratedTime (using system_clock)
std::filesystem::file_time_type GeneratedTime
GeneratedTime convertTime(const typename CLOCK::time_point &t0)
Convert a time_point from an arbitrary clock to GeneratedTime.
std::string toString(const GeneratedTime &t)
Convert a GeneratedTime to a std::string (using system_clock)