mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-29 05:46:16 +00:00
clock_gettime fixes for windows (#2659)
* Using OrbisKernelTimespec under clock_gettime, orbis_clock_gettime, sceKernelClockGettime to fix compatibility issues. * final fix test * Roamic suggestions
This commit is contained in:
parent
2a05af22e1
commit
b1885badda
1 changed files with 8 additions and 7 deletions
|
@ -172,7 +172,7 @@ static s32 clock_gettime(u32 clock_id, struct timespec* ts) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int PS4_SYSV_ABI orbis_clock_gettime(s32 clock_id, struct timespec* ts) {
|
int PS4_SYSV_ABI orbis_clock_gettime(s32 clock_id, struct OrbisKernelTimespec* ts) {
|
||||||
if (ts == nullptr) {
|
if (ts == nullptr) {
|
||||||
return ORBIS_KERNEL_ERROR_EFAULT;
|
return ORBIS_KERNEL_ERROR_EFAULT;
|
||||||
}
|
}
|
||||||
|
@ -265,17 +265,18 @@ int PS4_SYSV_ABI orbis_clock_gettime(s32 clock_id, struct timespec* ts) {
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return clock_gettime(pclock_id, ts);
|
timespec t{};
|
||||||
|
int result = clock_gettime(pclock_id, &t);
|
||||||
|
ts->tv_sec = t.tv_sec;
|
||||||
|
ts->tv_nsec = t.tv_nsec;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PS4_SYSV_ABI sceKernelClockGettime(s32 clock_id, OrbisKernelTimespec* tp) {
|
int PS4_SYSV_ABI sceKernelClockGettime(s32 clock_id, OrbisKernelTimespec* tp) {
|
||||||
struct timespec ts;
|
const auto res = orbis_clock_gettime(clock_id, tp);
|
||||||
const auto res = orbis_clock_gettime(clock_id, &ts);
|
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
return ErrnoToSceKernelError(res);
|
return ErrnoToSceKernelError(res);
|
||||||
}
|
}
|
||||||
tp->tv_sec = ts.tv_sec;
|
|
||||||
tp->tv_nsec = ts.tv_nsec;
|
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,4 +470,4 @@ void RegisterTime(Core::Loader::SymbolsResolver* sym) {
|
||||||
LIB_FUNCTION("-o5uEDpN+oY", "libkernel", 1, "libkernel", 1, 1, sceKernelConvertUtcToLocaltime);
|
LIB_FUNCTION("-o5uEDpN+oY", "libkernel", 1, "libkernel", 1, 1, sceKernelConvertUtcToLocaltime);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Libraries::Kernel
|
} // namespace Libraries::Kernel
|
Loading…
Add table
Add a link
Reference in a new issue