From f4110c43a78a1b0d13c33ddbd75bd5b552bcfdda Mon Sep 17 00:00:00 2001 From: DanielSvoboda Date: Sun, 2 Mar 2025 16:32:28 -0300 Subject: [PATCH] Fix time - sceKernelClockGettime (#2582) --- src/core/libraries/kernel/time.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/core/libraries/kernel/time.cpp b/src/core/libraries/kernel/time.cpp index 2565b8078..508e54089 100644 --- a/src/core/libraries/kernel/time.cpp +++ b/src/core/libraries/kernel/time.cpp @@ -115,14 +115,16 @@ int PS4_SYSV_ABI sceKernelClockGettime(s32 clock_id, OrbisKernelTimespec* tp) { break; } - timespec t{}; - int result = clock_gettime(pclock_id, &t); - tp->tv_sec = t.tv_sec; - tp->tv_nsec = t.tv_nsec; - if (result == 0) { - return ORBIS_OK; + time_t raw_time = time(nullptr); + + if (raw_time == (time_t)(-1)) { + return ORBIS_KERNEL_ERROR_EINVAL; } - return ORBIS_KERNEL_ERROR_EINVAL; + + tp->tv_sec = static_cast(raw_time); + tp->tv_nsec = 0; + + return ORBIS_OK; } int PS4_SYSV_ABI posix_clock_gettime(s32 clock_id, OrbisKernelTimespec* time) {