2019-07-15 17:52:35 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
2019-09-19 00:45:11 +00:00
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Pcv.Bpc
|
2019-07-15 17:52:35 +00:00
|
|
|
|
{
|
2019-09-19 00:45:11 +00:00
|
|
|
|
[Service("bpc:r")] // 1.0.0 - 8.1.0
|
2019-07-15 17:52:35 +00:00
|
|
|
|
class IRtcManager : IpcService
|
|
|
|
|
{
|
|
|
|
|
public IRtcManager(ServiceCtx context) { }
|
|
|
|
|
|
2021-04-13 22:01:24 +00:00
|
|
|
|
[CommandHipc(0)]
|
2019-07-15 17:52:35 +00:00
|
|
|
|
// 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
|
2022-12-24 17:30:39 +00:00
|
|
|
|
rtcValue = (ulong)(DateTime.Now.ToUniversalTime() - DateTime.UnixEpoch).TotalSeconds;
|
2019-07-15 17:52:35 +00:00
|
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|