2019-07-15 18:52:35 +01:00
|
|
|
|
using System;
|
|
|
|
|
|
2019-09-19 01:45:11 +01:00
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Pcv.Bpc
|
2019-07-15 18:52:35 +01:00
|
|
|
|
{
|
2019-09-19 01:45:11 +01:00
|
|
|
|
[Service("bpc:r")] // 1.0.0 - 8.1.0
|
2019-07-15 18:52:35 +01:00
|
|
|
|
class IRtcManager : IpcService
|
|
|
|
|
{
|
|
|
|
|
public IRtcManager(ServiceCtx context) { }
|
|
|
|
|
|
2021-04-13 23:01:24 +01:00
|
|
|
|
[CommandHipc(0)]
|
2019-07-15 18:52:35 +01: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 18:52:35 +01:00
|
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|