Only use date library on macOS.

This commit is contained in:
squidbus 2024-07-17 01:56:07 -07:00 committed by TheTurtle
parent b557de2c62
commit 426d82d07b
3 changed files with 17 additions and 4 deletions

View file

@ -3,7 +3,6 @@
#include <chrono>
#include <thread>
#include <date/tz.h>
#include <boost/asio/io_context.hpp>
@ -33,6 +32,9 @@
#include <windows.h>
#else
#include <sys/mman.h>
#ifdef __APPLE__
#include <date/tz.h>
#endif
#endif
namespace Libraries::Kernel {
@ -182,7 +184,12 @@ s64 PS4_SYSV_ABI ps4__write(int d, const void* buf, std::size_t nbytes) {
int PS4_SYSV_ABI sceKernelConvertUtcToLocaltime(time_t time, time_t* local_time,
struct OrbisTimesec* st, unsigned long* dst_sec) {
LOG_TRACE(Kernel, "Called");
#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
auto info = time_zone->get_info(std::chrono::system_clock::now());
*local_time = info.offset.count() + info.save.count() * 60 + time;