From 7c2b7bd8139eec83f994ffb842a90165415e2083 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Tue, 12 May 2026 03:51:58 +0300 Subject: [PATCH] revert os.clock changes --- src/logic/scripting/lua/lua_extensions.cpp | 12 ------------ src/util/platform.cpp | 20 -------------------- src/util/platform.hpp | 2 -- 3 files changed, 34 deletions(-) diff --git a/src/logic/scripting/lua/lua_extensions.cpp b/src/logic/scripting/lua/lua_extensions.cpp index f8a200de1..a7de3fdd8 100644 --- a/src/logic/scripting/lua/lua_extensions.cpp +++ b/src/logic/scripting/lua/lua_extensions.cpp @@ -8,7 +8,6 @@ #include "engine/Engine.hpp" #include "devtools/DebuggingServer.hpp" #include "logic/scripting/scripting.hpp" -#include "util/platform.hpp" using namespace devtools; using namespace scripting; @@ -382,10 +381,6 @@ static int l_debug_is_debugging(lua::State* L) { return lua::pushboolean(L, engine->getDebuggingServer() != nullptr); } -static int l_os_clock(lua::State* L) { - return lua::pushnumber(L, platform::clock()); -} - void initialize_libs_extends(lua::State* L) { if (lua::getglobal(L, "debug")) { lua::pushcfunction(L, lua::wrap); @@ -420,11 +415,4 @@ void initialize_libs_extends(lua::State* L) { lua::pop(L); } - - if (lua::getglobal(L, "os")) { - lua::pushcfunction(L, lua::wrap); - lua::setfield(L, "clock"); - - lua::pop(L); - } } diff --git a/src/util/platform.cpp b/src/util/platform.cpp index 026c6feb4..f113641e5 100644 --- a/src/util/platform.cpp +++ b/src/util/platform.cpp @@ -327,23 +327,3 @@ bool platform::stdin_has_data() { return poll(&fds, 1, 0) == 1; #endif } - -double platform::clock() { -#ifdef _WIN32 - FILETIME createTime, exitTime, kernelTime, userTime; - - static HANDLE currentProcess = GetCurrentProcess(); - - if (GetProcessTimes(currentProcess, &createTime, &exitTime, &kernelTime, &userTime)) { - ULARGE_INTEGER kernel, user; - kernel.LowPart = kernelTime.dwLowDateTime; - kernel.HighPart = kernelTime.dwHighDateTime; - user.LowPart = userTime.dwLowDateTime; - user.HighPart = userTime.dwHighDateTime; - - return static_cast(kernel.QuadPart + user.QuadPart) / 1000'0000.0; - } -#else - return std::clock() / static_cast(CLOCKS_PER_SEC); -#endif -} diff --git a/src/util/platform.hpp b/src/util/platform.hpp index 4c049a0da..54c56a0c5 100644 --- a/src/util/platform.hpp +++ b/src/util/platform.hpp @@ -25,6 +25,4 @@ namespace platform { bool open_url(const std::string& url); /// @brief Check if stdin has input bool stdin_has_data(); - /// @brief Precise wrapper for std::clock (especially for Windows) - double clock(); }