ISteadyClock.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. namespace Ryujinx.HLE.HOS.Services.Time
  3. {
  4. class ISteadyClock : IpcService
  5. {
  6. private ulong _testOffset;
  7. public ISteadyClock()
  8. {
  9. _testOffset = 0;
  10. }
  11. [Command(0)]
  12. // GetCurrentTimePoint() -> nn::time::SteadyClockTimePoint
  13. public long GetCurrentTimePoint(ServiceCtx context)
  14. {
  15. context.ResponseData.Write((long)(System.Diagnostics.Process.GetCurrentProcess().StartTime - DateTime.Now).TotalSeconds);
  16. for (int i = 0; i < 0x10; i++)
  17. {
  18. context.ResponseData.Write((byte)0);
  19. }
  20. return 0;
  21. }
  22. [Command(1)]
  23. // GetTestOffset() -> nn::TimeSpanType
  24. public long GetTestOffset(ServiceCtx context)
  25. {
  26. context.ResponseData.Write(_testOffset);
  27. return 0;
  28. }
  29. [Command(2)]
  30. // SetTestOffset(nn::TimeSpanType)
  31. public long SetTestOffset(ServiceCtx context)
  32. {
  33. _testOffset = context.RequestData.ReadUInt64();
  34. return 0;
  35. }
  36. }
  37. }