use high_resolution_clock instead of system_clock

This commit is contained in:
Lion Kortlepel
2022-11-11 21:49:54 +01:00
parent 0327b41611
commit c7f6835702

View File

@@ -85,7 +85,7 @@ static inline void SplitString(std::string const& str, const char delim, std::ve
static std::string GetDate() {
std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
time_t tt = std::chrono::system_clock::to_time_t(now);
time_t tt = std::chrono::high_resolution_clock::to_time_t(now);
auto local_tm = std::localtime(&tt);
char buf[30];
std::string date;
@@ -326,7 +326,7 @@ void TConsole::Command_Debug(const std::string&, const std::vector<std::string>&
auto Now = std::chrono::system_clock::now();
auto Seconds = std::chrono::duration_cast<std::chrono::seconds>(Now - Locked->ConnectionTime);
std::string ConnectedSince = fmt::format("{:%Y/%m/%d %H:%M:%S}, {:%H:%M:%S} ago ({} seconds)",
fmt::localtime(std::chrono::system_clock::to_time_t(Locked->ConnectionTime)),
fmt::localtime(std::chrono::high_resolution_clock::to_time_t(Locked->ConnectionTime)),
Seconds,
Seconds.count());
Application::Console().WriteRaw(fmt::format(