From 20e9ae069c578e859e30aa5f366c2aafe45ce789 Mon Sep 17 00:00:00 2001 From: eladash Date: Thu, 19 Jul 2018 08:41:35 +0300 Subject: [PATCH] Fix sys_time_get_current_time --- rpcs3/Emu/Cell/lv2/sys_time.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/rpcs3/Emu/Cell/lv2/sys_time.cpp b/rpcs3/Emu/Cell/lv2/sys_time.cpp index 0e8a85f1e8..bf5cbaafe9 100644 --- a/rpcs3/Emu/Cell/lv2/sys_time.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_time.cpp @@ -177,13 +177,35 @@ s32 sys_time_get_current_time(vm::ptr sec, vm::ptr nsec) // get time since Epoch in nanoseconds const u64 time = s_time_aux_info.start_ftime * 100u + diff; + if (!sec) + { + return CELL_EFAULT; + } + *sec = time / 1000000000u; + + if (!nsec) + { + return CELL_EFAULT; + } + *nsec = time % 1000000000u; #else struct timespec ts; verify(HERE), ::clock_gettime(CLOCK_REALTIME, &ts) == 0; + if (!sec) + { + return CELL_EFAULT; + } + *sec = ts.tv_sec; + + if (!nsec) + { + return CELL_EFAULT; + } + *nsec = ts.tv_nsec; #endif