refactor: replace POSIX/Win32 APIs with standard C++ equivalents

Replaces platform-specific APIs across 21 files with std::chrono, std::fstream, std::filesystem, and std::this_thread. Adds PlatformTime.h utility header wrapping std::chrono::steady_clock for GetTickCount/QueryPerformanceCounter patterns.
This commit is contained in:
MatthewBeshay
2026-04-01 05:01:37 +11:00
parent 2f92b07c1f
commit ee31bfcec5
21 changed files with 196 additions and 306 deletions

View File

@@ -1,4 +1,4 @@
#include <ctime>
#include <chrono>
#include <cstdint> // for int64_t
#include "java/Random.h"
@@ -9,10 +9,8 @@ Random::Random() {
// only millisecond accuate, so use QueryPerformanceCounter here instead
int64_t seed;
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
seed = ts.tv_sec * 1000000000LL + ts.tv_nsec;
auto now = std::chrono::steady_clock::now().time_since_epoch();
seed = std::chrono::duration_cast<std::chrono::nanoseconds>(now).count();
seed += 8682522807148012LL;