IRtcManager.cs 851 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. namespace Ryujinx.HLE.HOS.Services.Pcv.Bpc
  3. {
  4. [Service("bpc:r")] // 1.0.0 - 8.1.0
  5. class IRtcManager : IpcService
  6. {
  7. public IRtcManager(ServiceCtx context) { }
  8. [CommandHipc(0)]
  9. // GetRtcTime() -> u64
  10. public ResultCode GetRtcTime(ServiceCtx context)
  11. {
  12. ResultCode result = GetExternalRtcValue(out ulong rtcValue);
  13. if (result == ResultCode.Success)
  14. {
  15. context.ResponseData.Write(rtcValue);
  16. }
  17. return result;
  18. }
  19. public static ResultCode GetExternalRtcValue(out ulong rtcValue)
  20. {
  21. // TODO: emulate MAX77620/MAX77812 RTC
  22. rtcValue = (ulong)(DateTime.Now.ToUniversalTime() - DateTime.UnixEpoch).TotalSeconds;
  23. return ResultCode.Success;
  24. }
  25. }
  26. }