revert os.clock changes

This commit is contained in:
MihailRis 2026-05-12 03:51:58 +03:00
parent bcbf09c916
commit 7c2b7bd813
3 changed files with 0 additions and 34 deletions

View file

@ -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<l_debug_error>);
@ -420,11 +415,4 @@ void initialize_libs_extends(lua::State* L) {
lua::pop(L);
}
if (lua::getglobal(L, "os")) {
lua::pushcfunction(L, lua::wrap<l_os_clock>);
lua::setfield(L, "clock");
lua::pop(L);
}
}

View file

@ -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<double>(kernel.QuadPart + user.QuadPart) / 1000'0000.0;
}
#else
return std::clock() / static_cast<double>(CLOCKS_PER_SEC);
#endif
}

View file

@ -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();
}