From 97d0c6242368f443c50395b2fa9d99a59f1df1e8 Mon Sep 17 00:00:00 2001 From: Thomas Guillemard Date: Sun, 14 Jul 2019 22:50:11 +0200 Subject: 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 --- Ryujinx.HLE/HOS/Horizon.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Ryujinx.HLE/HOS/Horizon.cs') diff --git a/Ryujinx.HLE/HOS/Horizon.cs b/Ryujinx.HLE/HOS/Horizon.cs index 496fbdbe..7523d2be 100644 --- a/Ryujinx.HLE/HOS/Horizon.cs +++ b/Ryujinx.HLE/HOS/Horizon.cs @@ -9,6 +9,7 @@ using Ryujinx.HLE.HOS.Kernel.Memory; using Ryujinx.HLE.HOS.Kernel.Process; using Ryujinx.HLE.HOS.Kernel.Threading; using Ryujinx.HLE.HOS.Services.Sm; +using Ryujinx.HLE.HOS.Services.Time.Clock; using Ryujinx.HLE.HOS.SystemState; using Ryujinx.HLE.Loaders.Executables; using Ryujinx.HLE.Loaders.Npdm; @@ -195,6 +196,11 @@ namespace Ryujinx.HLE.HOS LoadKeySet(); ContentManager = new ContentManager(device); + + // NOTE: Now we set the default internal offset of the steady clock like Nintendo does... even if it's strange this is accurate. + // TODO: use bpc:r and set:sys (and set external clock source id from settings) + DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + SteadyClockCore.Instance.SetInternalOffset(new TimeSpanType(((ulong)(DateTime.Now.ToUniversalTime() - UnixEpoch).TotalSeconds) * 1000000000)); } public void LoadCart(string exeFsDir, string romFsFile = null) -- cgit v1.2.3