Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions core/libs/prx/libkernel/Time/Time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,8 @@ int APS5_VABI clock_gettime_nid_postfix(int clockId, KernelTimespec* tp) {
}

int APS5_VABI gettimeofday_nid_postfix(KernelTimeval* tv, KernelTimezone* tz) {
if (tv == nullptr) {
APS5_INVALID_ARG_EX;
}
KernelTimeval ignoredTime{};
if (tv == nullptr) tv = &ignoredTime;
#ifdef _WIN32
FILETIME ft{};
GetSystemTimePreciseAsFileTime(&ft);
Expand All @@ -465,9 +464,8 @@ int APS5_VABI gettimeofday_nid_postfix(KernelTimeval* tv, KernelTimezone* tz) {
}

int APS5_VABI clock_getres_nid_postfix(int clockId, KernelTimespec* res) {
if (res == nullptr) {
APS5_INVALID_ARG_EX;
}
KernelTimespec ignoredResolution{};
if (res == nullptr) res = &ignoredResolution;
if (IsCpuClock(clockId))
return clock_getres_nid_postfix(GUEST_CLOCK_THREAD_CPUTIME_ID, res);
if (clockId == 1 || clockId == 2) {
Expand Down
5 changes: 5 additions & 0 deletions core/libs/tests/GuestFreebsdClocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ static void XtimeTicksAreGettimeofdayMicroseconds() {

int main() {
SecondClockReportsWholeSeconds();
KernelTimezone zone{-1, -1};
Require(gettimeofday_nid_postfix(nullptr, nullptr) == SCE_OK);
Require(gettimeofday_nid_postfix(nullptr, &zone) == SCE_OK && zone.tz_minuteswest == 0 && zone.tz_dsttime == 0);
const int nullResolutionClocks[] = {GUEST_CLOCK_REALTIME, GUEST_CLOCK_VIRTUAL, GUEST_CLOCK_MONOTONIC, GUEST_CLOCK_SECOND, GUEST_CLOCK_PROCESS_CPUTIME_ID};
for (const int clockId : nullResolutionClocks) Require(clock_getres_nid_postfix(clockId, nullptr) == SCE_OK);

KernelTimespec time{-1, -1};
Require(sceKernelClockGettime(GUEST_CLOCK_VIRTUAL, &time) == SCE_OK);
Expand Down
Loading