replace all clocks with a generic TimeType

This commit is contained in:
Lion Kortlepel
2022-11-11 21:58:00 +01:00
parent c7f6835702
commit 01bcc3d18c
10 changed files with 39 additions and 33 deletions

View File

@@ -119,7 +119,7 @@ TClient::TClient(TServer& Server, ip::tcp::socket&& Socket)
: mServer(Server)
, mSocket(std::move(Socket))
, mDownSocket(ip::tcp::socket(Server.IoCtx()))
, mLastPingTime(std::chrono::high_resolution_clock::now()) {
, mLastPingTime(TimeType::now()) {
}
TClient::~TClient() {
@@ -127,11 +127,11 @@ TClient::~TClient() {
}
void TClient::UpdatePingTime() {
mLastPingTime = std::chrono::high_resolution_clock::now();
mLastPingTime = TimeType::now();
}
int TClient::SecondsSinceLastPing() {
auto seconds = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::high_resolution_clock::now() - mLastPingTime)
TimeType::now() - mLastPingTime)
.count();
return int(seconds);
}