mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-06 07:46:06 +00:00
change to system_clock for times converted to time_t
This commit is contained in:
@@ -101,7 +101,7 @@ public:
|
||||
// bytes sent on TCP
|
||||
std::atomic_size_t TcpSent = 0;
|
||||
|
||||
std::chrono::high_resolution_clock::time_point ConnectionTime{};
|
||||
std::chrono::system_clock::time_point ConnectionTime{};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
TScopedTimer(std::function<void(size_t)> OnDestroy);
|
||||
~TScopedTimer();
|
||||
auto GetElapsedTime() const {
|
||||
auto EndTime = std::chrono::high_resolution_clock::now();
|
||||
auto EndTime = std::chrono::system_clock::now();
|
||||
auto Delta = EndTime - mStartTime;
|
||||
size_t TimeDelta = Delta / std::chrono::milliseconds(1);
|
||||
return TimeDelta;
|
||||
@@ -20,6 +20,6 @@ public:
|
||||
std::function<void(size_t /* time_ms */)> OnDestroy { nullptr };
|
||||
|
||||
private:
|
||||
std::chrono::high_resolution_clock::time_point mStartTime;
|
||||
std::chrono::system_clock::time_point mStartTime;
|
||||
std::string Name;
|
||||
};
|
||||
|
||||
@@ -323,7 +323,7 @@ void TConsole::Command_Debug(const std::string&, const std::vector<std::string>&
|
||||
}
|
||||
State += "Disconnected";
|
||||
}
|
||||
auto Now = std::chrono::high_resolution_clock::now();
|
||||
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)),
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
#include "Common.h"
|
||||
|
||||
TScopedTimer::TScopedTimer()
|
||||
: mStartTime(std::chrono::high_resolution_clock::now()) {
|
||||
: mStartTime(std::chrono::system_clock::now()) {
|
||||
}
|
||||
|
||||
TScopedTimer::TScopedTimer(const std::string& mName)
|
||||
: mStartTime(std::chrono::high_resolution_clock::now())
|
||||
: mStartTime(std::chrono::system_clock::now())
|
||||
, Name(mName) {
|
||||
}
|
||||
|
||||
TScopedTimer::TScopedTimer(std::function<void(size_t)> OnDestroy)
|
||||
: OnDestroy(OnDestroy)
|
||||
, mStartTime(std::chrono::high_resolution_clock::now()) {
|
||||
, mStartTime(std::chrono::system_clock::now()) {
|
||||
}
|
||||
|
||||
TScopedTimer::~TScopedTimer() {
|
||||
auto EndTime = std::chrono::high_resolution_clock::now();
|
||||
auto EndTime = std::chrono::system_clock::now();
|
||||
auto Delta = EndTime - mStartTime;
|
||||
size_t TimeDelta = Delta / std::chrono::milliseconds(1);
|
||||
if (OnDestroy) {
|
||||
|
||||
Reference in New Issue
Block a user