mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-05 08:52:36 +00:00
wraping timespec into else so clockgettime only gets call on monotonic clock calls.
This commit is contained in:
parent
a7c1b897e1
commit
9ba492a778
@ -116,19 +116,18 @@ int PS4_SYSV_ABI sceKernelClockGettime(s32 clock_id, OrbisKernelTimespec* tp) {
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
struct timespec ts;
|
||||
if (clock_gettime(pclock_id, &ts) != 0) {
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
if (pclock_id == CLOCK_REALTIME) {
|
||||
time_t raw_time = time(nullptr);
|
||||
if (raw_time == (time_t)(-1)) {
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
tp->tv_sec = static_cast<long>(raw_time);
|
||||
tp->tv_nsec = ts.tv_nsec;
|
||||
tp->tv_nsec = 0;
|
||||
} else {
|
||||
struct timespec ts;
|
||||
if (clock_gettime(pclock_id, &ts) != 0) {
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
tp->tv_sec = ts.tv_sec;
|
||||
tp->tv_nsec = ts.tv_nsec;
|
||||
}
|
||||
@ -136,6 +135,7 @@ int PS4_SYSV_ABI sceKernelClockGettime(s32 clock_id, OrbisKernelTimespec* tp) {
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
|
||||
int PS4_SYSV_ABI posix_clock_gettime(s32 clock_id, OrbisKernelTimespec* time) {
|
||||
int result = sceKernelClockGettime(clock_id, time);
|
||||
if (result < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user