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