Ryujinx/Ryujinx.HLE/HOS/Services/Pcv/Bpc/IRtcManager.cs
Ac_K a0720b5681 Refactoring HOS folder structure (#771)
* Refactoring HOS folder structure

Refactoring HOS folder structure:

- Added some subfolders when needed (Following structure decided in private).
- Added some `Types` folders when needed.
- Little cleanup here and there.
- Add services placeholders for every HOS services (close #766 and #753).

* Remove Types namespaces
2019-09-19 10:45:11 +10:00

34 lines
925 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) { }
[Command(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
DateTime unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
rtcValue = (ulong)(DateTime.Now.ToUniversalTime() - unixEpoch).TotalSeconds;
return ResultCode.Success;
}
}
}