mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-07 12:54:00 +00:00
19 lines
412 B
C++
19 lines
412 B
C++
#ifndef OPENMW_COMPONENTS_MISC_TIMECONVERT_H
|
|
#define OPENMW_COMPONENTS_MISC_TIMECONVERT_H
|
|
|
|
#include <ctime>
|
|
#include <chrono>
|
|
|
|
namespace Misc
|
|
{
|
|
template <typename TP>
|
|
inline std::time_t to_time_t(TP tp)
|
|
{
|
|
using namespace std::chrono;
|
|
auto sctp = time_point_cast<system_clock::duration>(tp - TP::clock::now() + system_clock::now());
|
|
return system_clock::to_time_t(sctp);
|
|
}
|
|
} // namespace Misc
|
|
|
|
#endif
|