diff --git a/src/lua/functions/core/game/global_functions.cpp b/src/lua/functions/core/game/global_functions.cpp index af89c1854f7..c8a857cfffa 100644 --- a/src/lua/functions/core/game/global_functions.cpp +++ b/src/lua/functions/core/game/global_functions.cpp @@ -217,7 +217,7 @@ int GlobalFunctions::luaGetWorldLight(lua_State* L) { int GlobalFunctions::luaGetWorldUpTime(lua_State* L) { // getWorldUpTime() - uint64_t uptime = (OTSYS_TIME() - ProtocolStatus::start) / 1000; + uint64_t uptime = (OTSYS_TIME(true) - ProtocolStatus::start) / 1000; lua_pushnumber(L, uptime); return 1; } diff --git a/src/server/network/protocol/protocolstatus.cpp b/src/server/network/protocol/protocolstatus.cpp index 1674b80a2b5..15a3f74be07 100644 --- a/src/server/network/protocol/protocolstatus.cpp +++ b/src/server/network/protocol/protocolstatus.cpp @@ -23,7 +23,7 @@ std::string ProtocolStatus::SERVER_VERSION = "3.0"; std::string ProtocolStatus::SERVER_DEVELOPERS = "OpenTibiaBR Organization"; std::map ProtocolStatus::ipConnectMap; -const uint64_t ProtocolStatus::start = OTSYS_TIME(); +const uint64_t ProtocolStatus::start = OTSYS_TIME(true); void ProtocolStatus::onRecvFirstMessage(NetworkMessage &msg) { uint32_t ip = getIP(); diff --git a/src/utils/tools.cpp b/src/utils/tools.cpp index 6504fda859d..f89b2c2f217 100644 --- a/src/utils/tools.cpp +++ b/src/utils/tools.cpp @@ -1515,7 +1515,10 @@ void UPDATE_OTSYS_TIME() { OTSYSTIME = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); } -int64_t OTSYS_TIME() { +int64_t OTSYS_TIME(bool useTime) { + if (useTime) { + return std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); + } return OTSYSTIME; } diff --git a/src/utils/tools.hpp b/src/utils/tools.hpp index 1f8ed382244..a4426a066a8 100644 --- a/src/utils/tools.hpp +++ b/src/utils/tools.hpp @@ -147,7 +147,7 @@ bool isCaskItem(uint16_t itemId); std::string getObjectCategoryName(ObjectCategory_t category); bool isValidObjectCategory(ObjectCategory_t category); -int64_t OTSYS_TIME(); +int64_t OTSYS_TIME(bool useTime = false); void UPDATE_OTSYS_TIME(); SpellGroup_t stringToSpellGroup(const std::string &value);