From 3bf62c7a8a68822e608c2f5f5748bd111d7ee4cf Mon Sep 17 00:00:00 2001 From: Chloe Marcec Date: Sat, 30 Jan 2021 21:03:10 +1100 Subject: Move to GetGlobalTimeNs, fix GetTotalPhysicalMemoryAvailable --- src/core/hle/kernel/k_resource_limit.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/core/hle/kernel/k_resource_limit.cpp') diff --git a/src/core/hle/kernel/k_resource_limit.cpp b/src/core/hle/kernel/k_resource_limit.cpp index f943d6562..b3076b030 100644 --- a/src/core/hle/kernel/k_resource_limit.cpp +++ b/src/core/hle/kernel/k_resource_limit.cpp @@ -14,8 +14,7 @@ namespace Kernel { namespace { -static const s64 DefaultTimeout = - Core::Timing::msToCycles(std::chrono::milliseconds{10000}); // 10 seconds +constexpr s64 DefaultTimeout = 10000000000; // 10 seconds } KResourceLimit::KResourceLimit(KernelCore& kernel, Core::System& system) @@ -86,7 +85,7 @@ ResultCode KResourceLimit::SetLimitValue(LimitableResource which, s64 value) { } bool KResourceLimit::Reserve(LimitableResource which, s64 value) { - return Reserve(which, value, system.CoreTiming().GetClockTicks() + DefaultTimeout); + return Reserve(which, value, system.CoreTiming().GetGlobalTimeNs().count() + DefaultTimeout); } bool KResourceLimit::Reserve(LimitableResource which, s64 value, s64 timeout) { @@ -117,7 +116,7 @@ bool KResourceLimit::Reserve(LimitableResource which, s64 value, s64 timeout) { } if (current_hints[index] + value <= limit_values[index] && - (timeout < 0 || system.CoreTiming().GetClockTicks() < static_cast(timeout))) { + (timeout < 0 || system.CoreTiming().GetGlobalTimeNs().count() < timeout)) { waiter_count++; cond_var.Wait(&m_lock, timeout); waiter_count--; -- cgit v1.2.3