TickBasedSteadyClockCore.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using Ryujinx.Common;
  2. using Ryujinx.HLE.HOS.Kernel.Threading;
  3. namespace Ryujinx.HLE.HOS.Services.Time.Clock
  4. {
  5. class TickBasedSteadyClockCore : SteadyClockCore
  6. {
  7. private static TickBasedSteadyClockCore _instance;
  8. public static TickBasedSteadyClockCore Instance
  9. {
  10. get
  11. {
  12. if (_instance == null)
  13. {
  14. _instance = new TickBasedSteadyClockCore();
  15. }
  16. return _instance;
  17. }
  18. }
  19. private TickBasedSteadyClockCore() {}
  20. public override SteadyClockTimePoint GetTimePoint(KThread thread)
  21. {
  22. SteadyClockTimePoint result = new SteadyClockTimePoint
  23. {
  24. TimePoint = 0,
  25. ClockSourceId = GetClockSourceId()
  26. };
  27. TimeSpanType ticksTimeSpan = TimeSpanType.FromTicks(thread.Context.CntpctEl0, thread.Context.CntfrqEl0);
  28. result.TimePoint = ticksTimeSpan.ToSeconds();
  29. return result;
  30. }
  31. }
  32. }