SteadyClockCore.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using Ryujinx.HLE.HOS.Kernel.Threading;
  2. using Ryujinx.HLE.Utilities;
  3. using System;
  4. namespace Ryujinx.HLE.HOS.Services.Time.Clock
  5. {
  6. abstract class SteadyClockCore
  7. {
  8. private UInt128 _clockSourceId;
  9. public SteadyClockCore()
  10. {
  11. _clockSourceId = new UInt128(Guid.NewGuid().ToByteArray());
  12. }
  13. public UInt128 GetClockSourceId()
  14. {
  15. return _clockSourceId;
  16. }
  17. public virtual TimeSpanType GetTestOffset()
  18. {
  19. return new TimeSpanType(0);
  20. }
  21. public virtual void SetTestOffset(TimeSpanType testOffset) {}
  22. public virtual ResultCode GetRtcValue(out ulong rtcValue)
  23. {
  24. rtcValue = 0;
  25. return ResultCode.NotImplemented;
  26. }
  27. public virtual ResultCode GetSetupResultValue()
  28. {
  29. return ResultCode.NotImplemented;
  30. }
  31. public virtual TimeSpanType GetInternalOffset()
  32. {
  33. return new TimeSpanType(0);
  34. }
  35. public virtual void SetInternalOffset(TimeSpanType internalOffset) {}
  36. public virtual SteadyClockTimePoint GetTimePoint(KThread thread)
  37. {
  38. throw new NotImplementedException();
  39. }
  40. public SteadyClockTimePoint GetCurrentTimePoint(KThread thread)
  41. {
  42. SteadyClockTimePoint result = GetTimePoint(thread);
  43. result.TimePoint += GetTestOffset().ToSeconds();
  44. result.TimePoint += GetInternalOffset().ToSeconds();
  45. return result;
  46. }
  47. }
  48. }