aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Time/Clock/StandardNetworkSystemClockCore.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Time/Clock/StandardNetworkSystemClockCore.cs')
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/Clock/StandardNetworkSystemClockCore.cs42
1 files changed, 9 insertions, 33 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Time/Clock/StandardNetworkSystemClockCore.cs b/Ryujinx.HLE/HOS/Services/Time/Clock/StandardNetworkSystemClockCore.cs
index c00f460e..5037fb60 100644
--- a/Ryujinx.HLE/HOS/Services/Time/Clock/StandardNetworkSystemClockCore.cs
+++ b/Ryujinx.HLE/HOS/Services/Time/Clock/StandardNetworkSystemClockCore.cs
@@ -1,35 +1,28 @@
-using System;
-using Ryujinx.HLE.HOS.Kernel.Threading;
+using Ryujinx.HLE.HOS.Kernel.Threading;
namespace Ryujinx.HLE.HOS.Services.Time.Clock
{
class StandardNetworkSystemClockCore : SystemClockCore
{
- private SteadyClockCore _steadyClockCore;
- private SystemClockContext _context;
private TimeSpanType _standardNetworkClockSufficientAccuracy;
- private static StandardNetworkSystemClockCore instance;
+ private static StandardNetworkSystemClockCore _instance;
public static StandardNetworkSystemClockCore Instance
{
get
{
- if (instance == null)
+ if (_instance == null)
{
- instance = new StandardNetworkSystemClockCore(SteadyClockCore.Instance);
+ _instance = new StandardNetworkSystemClockCore(StandardSteadyClockCore.Instance);
}
- return instance;
+ return _instance;
}
}
- public StandardNetworkSystemClockCore(SteadyClockCore steadyClockCore)
+ public StandardNetworkSystemClockCore(StandardSteadyClockCore steadyClockCore) : base(steadyClockCore)
{
- _steadyClockCore = steadyClockCore;
- _context = new SystemClockContext();
-
- _context.SteadyTimePoint.ClockSourceId = steadyClockCore.GetClockSourceId();
_standardNetworkClockSufficientAccuracy = new TimeSpanType(0);
}
@@ -40,25 +33,6 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock
return ResultCode.Success;
}
- public override SteadyClockCore GetSteadyClockCore()
- {
- return _steadyClockCore;
- }
-
- public override ResultCode GetSystemClockContext(KThread thread, out SystemClockContext context)
- {
- context = _context;
-
- return ResultCode.Success;
- }
-
- public override ResultCode SetSystemClockContext(SystemClockContext context)
- {
- _context = context;
-
- return ResultCode.Success;
- }
-
public bool IsStandardNetworkSystemClockAccuracySufficient(KThread thread)
{
SteadyClockCore steadyClockCore = GetSteadyClockCore();
@@ -66,7 +40,9 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock
bool isStandardNetworkClockSufficientAccuracy = false;
- if (_context.SteadyTimePoint.GetSpanBetween(currentTimePoint, out long outSpan) == ResultCode.Success)
+ ResultCode result = GetSystemClockContext(thread, out SystemClockContext context);
+
+ if (result == ResultCode.Success && context.SteadyTimePoint.GetSpanBetween(currentTimePoint, out long outSpan) == ResultCode.Success)
{
isStandardNetworkClockSufficientAccuracy = outSpan * 1000000000 < _standardNetworkClockSufficientAccuracy.NanoSeconds;
}