TickBasedSteadyClockCore.cs 1.0 KB

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