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
This commit is contained in:
Thomas Guillemard 2019-07-14 22:50:11 +02:00 committed by Ac_K
parent 4ad3936afd
commit 97d0c62423
13 changed files with 522 additions and 82 deletions

View file

@ -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)