geode/loader/src/utils/time.cpp

17 lines
433 B
C++
Raw Normal View History

2022-07-30 12:24:03 -04:00
#include <Geode/utils/general.hpp>
#ifdef GEODE_IS_WINDOWS
2022-10-30 14:56:36 -04:00
#define GEODE_CTIME() ctime_s(buf, sizeof buf, &t);
2022-07-30 12:24:03 -04:00
#else
2022-10-30 14:56:36 -04:00
#define GEODE_CTIME() strcpy(buf, ctime(&t));
2022-07-30 12:24:03 -04:00
#endif
2022-10-30 14:56:36 -04:00
std::string geode::utils::timePointAsString(std::chrono::system_clock::time_point const& tp) {
2022-07-30 12:24:03 -04:00
auto t = std::chrono::system_clock::to_time_t(tp);
char buf[128];
GEODE_CTIME();
std::string res = buf;
res.pop_back();
return res;
}