mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-05 18:24:12 +00:00
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:
@@ -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();
|
||||
};
|
||||
|
Reference in New Issue
Block a user