aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Time/Clock/StandardLocalSystemClockCore.cs
diff options
context:
space:
mode:
authorThomas Guillemard <me@thog.eu>2019-07-14 22:50:11 +0200
committerAc_K <Acoustik666@gmail.com>2019-07-14 22:50:11 +0200
commit97d0c6242368f443c50395b2fa9d99a59f1df1e8 (patch)
tree95fe1df8cc70f578f4c595feca6d2c253e4ad366 /Ryujinx.HLE/HOS/Services/Time/Clock/StandardLocalSystemClockCore.cs
parent4ad3936afd4ca393a05b330e3848958e9598e910 (diff)
Accurately implement steady & system clocks (#732)
* Improve SteadyClock implementation accuracy * Rewrite system clocks to be accurate * Implement IStaticService 100 & 101 * Add time:* permissions * Address comments * Realign TimePermissions definitions * Address gdk's comments * Fix after rebase
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Time/Clock/StandardLocalSystemClockCore.cs')
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/Clock/StandardLocalSystemClockCore.cs59
1 files changed, 59 insertions, 0 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Time/Clock/StandardLocalSystemClockCore.cs b/Ryujinx.HLE/HOS/Services/Time/Clock/StandardLocalSystemClockCore.cs
new file mode 100644
index 00000000..16550199
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Services/Time/Clock/StandardLocalSystemClockCore.cs
@@ -0,0 +1,59 @@
+using Ryujinx.HLE.HOS.Kernel.Threading;
+
+namespace Ryujinx.HLE.HOS.Services.Time.Clock
+{
+ class StandardLocalSystemClockCore : SystemClockCore
+ {
+ private SteadyClockCore _steadyClockCore;
+ private SystemClockContext _context;
+
+ private static StandardLocalSystemClockCore instance;
+
+ public static StandardLocalSystemClockCore Instance
+ {
+ get
+ {
+ if (instance == null)
+ {
+ instance = new StandardLocalSystemClockCore(SteadyClockCore.Instance);
+ }
+
+ return instance;
+ }
+ }
+
+ public StandardLocalSystemClockCore(SteadyClockCore steadyClockCore)
+ {
+ _steadyClockCore = steadyClockCore;
+ _context = new SystemClockContext();
+
+ _context.SteadyTimePoint.ClockSourceId = steadyClockCore.GetClockSourceId();
+ }
+
+ public override ResultCode Flush(SystemClockContext context)
+ {
+ // TODO: set:sys SetUserSystemClockContext
+
+ 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;
+ }
+ }
+}