StandardLocalSystemClockCore.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using Ryujinx.HLE.HOS.Kernel.Threading;
  2. namespace Ryujinx.HLE.HOS.Services.Time.Clock
  3. {
  4. class StandardLocalSystemClockCore : SystemClockCore
  5. {
  6. private SteadyClockCore _steadyClockCore;
  7. private SystemClockContext _context;
  8. private static StandardLocalSystemClockCore instance;
  9. public static StandardLocalSystemClockCore Instance
  10. {
  11. get
  12. {
  13. if (instance == null)
  14. {
  15. instance = new StandardLocalSystemClockCore(SteadyClockCore.Instance);
  16. }
  17. return instance;
  18. }
  19. }
  20. public StandardLocalSystemClockCore(SteadyClockCore steadyClockCore)
  21. {
  22. _steadyClockCore = steadyClockCore;
  23. _context = new SystemClockContext();
  24. _context.SteadyTimePoint.ClockSourceId = steadyClockCore.GetClockSourceId();
  25. }
  26. public override ResultCode Flush(SystemClockContext context)
  27. {
  28. // TODO: set:sys SetUserSystemClockContext
  29. return ResultCode.Success;
  30. }
  31. public override SteadyClockCore GetSteadyClockCore()
  32. {
  33. return _steadyClockCore;
  34. }
  35. public override ResultCode GetSystemClockContext(KThread thread, out SystemClockContext context)
  36. {
  37. context = _context;
  38. return ResultCode.Success;
  39. }
  40. public override ResultCode SetSystemClockContext(SystemClockContext context)
  41. {
  42. _context = context;
  43. return ResultCode.Success;
  44. }
  45. }
  46. }