msys2: fix build (#3818)

* cmake: fix mingw-w64 build

* time.cpp: fix build with Clang on Windows

* tls.h: include malloc.h for alloca
This commit is contained in:
oltolm
2025-11-22 09:32:29 +01:00
committed by GitHub
parent 56109a1331
commit 4922d526fe
4 changed files with 35 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <ctime>
#include <thread>
#include "common/assert.h"
@@ -485,25 +486,41 @@ Common::NativeClock* GetClock() {
s32 PS4_SYSV_ABI sceKernelConvertUtcToLocaltime(time_t time, time_t* local_time,
struct OrbisTimesec* st, u64* dst_sec) {
LOG_TRACE(Kernel, "Called");
#ifdef _WIN32
TIME_ZONE_INFORMATION tz{};
DWORD res = GetTimeZoneInformation(&tz);
*local_time = time - tz.Bias;
if (st != nullptr) {
st->t = time;
st->west_sec = -tz.Bias * 60;
st->dst_sec = res == TIME_ZONE_ID_DAYLIGHT ? -_dstbias : 0;
}
if (dst_sec != nullptr) {
*dst_sec = res == TIME_ZONE_ID_DAYLIGHT ? -_dstbias : 0;
}
#else
#ifdef __APPLE__
// std::chrono::current_zone() not available yet.
const auto* time_zone = date::current_zone();
#else
const auto* time_zone = std::chrono::current_zone();
#endif
#endif // __APPLE__
auto info = time_zone->get_info(std::chrono::system_clock::now());
*local_time = info.offset.count() + info.save.count() * 60 + time;
if (st != nullptr) {
st->t = time;
st->west_sec = info.offset.count() * 60;
st->west_sec = info.offset.count();
st->dst_sec = info.save.count() * 60;
}
if (dst_sec != nullptr) {
*dst_sec = info.save.count() * 60;
}
#endif // _WIN32
return ORBIS_OK;
}
@@ -565,4 +582,4 @@ void RegisterTime(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("-o5uEDpN+oY", "libkernel", 1, "libkernel", sceKernelConvertUtcToLocaltime);
}
} // namespace Libraries::Kernel
} // namespace Libraries::Kernel

View File

@@ -5,6 +5,9 @@
#include <cstring>
#include "common/types.h"
#ifdef _WIN32
#include <malloc.h>
#endif
namespace Xbyak {
class CodeGenerator;