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