mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-03 16:25:35 +00:00
add real uptime counter, for use in lua later
This commit is contained in:
parent
e4979bb6e2
commit
f9cb9af078
@ -6,6 +6,7 @@
|
|||||||
/// Created by Anonymous275 on 7/28/2020
|
/// Created by Anonymous275 on 7/28/2020
|
||||||
///
|
///
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <chrono>
|
||||||
#include <string>
|
#include <string>
|
||||||
extern std::string ServerName;
|
extern std::string ServerName;
|
||||||
extern std::string ServerDesc;
|
extern std::string ServerDesc;
|
||||||
@ -25,4 +26,9 @@ extern bool Private;
|
|||||||
extern int MaxCars;
|
extern int MaxCars;
|
||||||
extern bool Debug;
|
extern bool Debug;
|
||||||
extern int Port;
|
extern int Port;
|
||||||
extern int PPS;
|
extern int PPS;
|
||||||
|
|
||||||
|
extern std::chrono::time_point<std::chrono::high_resolution_clock> StartTime;
|
||||||
|
inline std::chrono::seconds GetUptimeInSeconds() {
|
||||||
|
return std::chrono::duration_cast<std::chrono::seconds>(std::chrono::high_resolution_clock::now() - StartTime);
|
||||||
|
}
|
||||||
|
@ -21,6 +21,7 @@ bool Private;
|
|||||||
int MaxCars;
|
int MaxCars;
|
||||||
bool Debug;
|
bool Debug;
|
||||||
int Port;
|
int Port;
|
||||||
|
std::chrono::time_point<std::chrono::high_resolution_clock> StartTime;
|
||||||
|
|
||||||
void SetValues(const std::string& Line, int Index) {
|
void SetValues(const std::string& Line, int Index) {
|
||||||
int state = 0;
|
int state = 0;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "CustomAssert.h"
|
#include "CustomAssert.h"
|
||||||
|
|
||||||
|
#include "Settings.h"
|
||||||
#include "Startup.h"
|
#include "Startup.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
@ -36,6 +37,7 @@ int main(int argc, char* argv[]) {
|
|||||||
std::thread t1(loop);
|
std::thread t1(loop);
|
||||||
t1.detach();
|
t1.detach();
|
||||||
#endif
|
#endif
|
||||||
|
StartTime = std::chrono::high_resolution_clock::now();
|
||||||
ConsoleInit();
|
ConsoleInit();
|
||||||
InitServer(argc, argv);
|
InitServer(argc, argv);
|
||||||
InitConfig();
|
InitConfig();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user