aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Bpc
diff options
context:
space:
mode:
authorThomas Guillemard <me@thog.eu>2019-07-15 19:52:35 +0200
committerAc_K <Acoustik666@gmail.com>2019-07-15 19:52:35 +0200
commit1f3a34dd7a5977fc340de310b2109493e5e6973f (patch)
tree95b6e42b3e99fec08b1c361fe8fb82510471514d /Ryujinx.HLE/HOS/Services/Bpc
parentd8424a63c637f0636e301252b2b8a1fb90f2457d (diff)
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
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Bpc')
-rw-r--r--Ryujinx.HLE/HOS/Services/Bpc/IRtcManager.cs34
1 files changed, 34 insertions, 0 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Bpc/IRtcManager.cs b/Ryujinx.HLE/HOS/Services/Bpc/IRtcManager.cs
new file mode 100644
index 00000000..5ff9410a
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Services/Bpc/IRtcManager.cs
@@ -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;
+ }
+ }
+}