Implement time:* 2.0.0 & 3.0.0 commands (#735)
* Finish ISteadyClock implementation * Implement IsStandardNetworkSystemClockAccuracySufficient Also use signed values for offsets and TimeSpanType * Address comments * Fix one missing nit and improve one comment
This commit is contained in:
parent
d8424a63c6
commit
1f3a34dd7a
8 changed files with 189 additions and 17 deletions
34
Ryujinx.HLE/HOS/Services/Bpc/IRtcManager.cs
Normal file
34
Ryujinx.HLE/HOS/Services/Bpc/IRtcManager.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Bpc
|
||||
{
|
||||
[Service("bpc:r")]
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue