feat: Remove reinterpret_casts from AG race timer script and add method and chat command to get current server uptime (#1673)

* use steady_clock race timer

* formatting and const

* improve time interface

* added uptime chat command

* fix bug and update documentation

* inrease /uptime GM level requirement

* update GM level for /uptime (again)

* made changes according to feedback
This commit is contained in:
jadebenn
2024-12-17 14:06:16 -06:00
committed by GitHub
parent ba364800fe
commit 77b42daca1
6 changed files with 79 additions and 54 deletions

View File

@@ -1,5 +1,6 @@
#pragma once
#include <string>
#include <chrono>
#include <csignal>
#include "RakPeerInterface.h"
#include "ReplicaManager.h"
@@ -80,6 +81,11 @@ public:
const ServerType GetServerType() const { return mServerType; }
[[nodiscard]]
std::chrono::steady_clock::duration GetUptime() const {
return std::chrono::steady_clock::now() - mStartTime;
}
private:
bool Startup();
void Shutdown();
@@ -114,4 +120,5 @@ protected:
SystemAddress mMasterSystemAddress;
std::string mMasterIP;
int mMasterPort;
std::chrono::steady_clock::time_point mStartTime = std::chrono::steady_clock::now();
};