1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-21 08:02:12 +00:00
Ryujinx/Ryujinx.HLE/HOS/Services/Pcv/Bpc/IRtcManager.cs
Berkan Diler 37d27c4c99
Some minor cleanups and optimizations (#4174)
* Replace Array.Clear(x, 0, x.Length) with Array.Clear(x)

* Use DateTime.UnixEpoch field

* Replace SHA256.ComputeHash calls with static SHA256.HashData call

More performant and avoids the need to initialize a SHA256 instance.
2022-12-24 14:30:39 -03:00

32 lines
851 B
C#

using System;
namespace Ryujinx.HLE.HOS.Services.Pcv.Bpc
{
[Service("bpc:r")] // 1.0.0 - 8.1.0
class IRtcManager : IpcService
{
public IRtcManager(ServiceCtx context) { }
[CommandHipc(0)]
// GetRtcTime() -> u64
public ResultCode GetRtcTime(ServiceCtx context)
{
ResultCode result = GetExternalRtcValue(out ulong rtcValue);
if (result == ResultCode.Success)
{
context.ResponseData.Write(rtcValue);
}
return result;
}
public static ResultCode GetExternalRtcValue(out ulong rtcValue)
{
// TODO: emulate MAX77620/MAX77812 RTC
rtcValue = (ulong)(DateTime.Now.ToUniversalTime() - DateTime.UnixEpoch).TotalSeconds;
return ResultCode.Success;
}
}
}