From 62b827f474f0aa2152dd339fcc7cf31084e16a0b Mon Sep 17 00:00:00 2001 From: emmauss Date: Tue, 20 Feb 2018 22:09:23 +0200 Subject: Split main project into core,graphics and chocolarm4 subproject (#29) --- Ryujinx.Core/OsHle/Objects/Time/ISteadyClock.cs | 20 +++++++++++ Ryujinx.Core/OsHle/Objects/Time/ISystemClock.cs | 42 ++++++++++++++++++++++ .../OsHle/Objects/Time/ITimeZoneService.cs | 20 +++++++++++ Ryujinx.Core/OsHle/Objects/Time/SystemClockType.cs | 9 +++++ 4 files changed, 91 insertions(+) create mode 100644 Ryujinx.Core/OsHle/Objects/Time/ISteadyClock.cs create mode 100644 Ryujinx.Core/OsHle/Objects/Time/ISystemClock.cs create mode 100644 Ryujinx.Core/OsHle/Objects/Time/ITimeZoneService.cs create mode 100644 Ryujinx.Core/OsHle/Objects/Time/SystemClockType.cs (limited to 'Ryujinx.Core/OsHle/Objects/Time') diff --git a/Ryujinx.Core/OsHle/Objects/Time/ISteadyClock.cs b/Ryujinx.Core/OsHle/Objects/Time/ISteadyClock.cs new file mode 100644 index 00000000..1116b849 --- /dev/null +++ b/Ryujinx.Core/OsHle/Objects/Time/ISteadyClock.cs @@ -0,0 +1,20 @@ +using Ryujinx.Core.OsHle.Ipc; +using System.Collections.Generic; + +namespace Ryujinx.Core.OsHle.Objects.Time +{ + class ISteadyClock : IIpcInterface + { + private Dictionary m_Commands; + + public IReadOnlyDictionary Commands => m_Commands; + + public ISteadyClock() + { + m_Commands = new Dictionary() + { + //... + }; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Objects/Time/ISystemClock.cs b/Ryujinx.Core/OsHle/Objects/Time/ISystemClock.cs new file mode 100644 index 00000000..3aa70691 --- /dev/null +++ b/Ryujinx.Core/OsHle/Objects/Time/ISystemClock.cs @@ -0,0 +1,42 @@ +using Ryujinx.Core.OsHle.Ipc; +using System; +using System.Collections.Generic; + +namespace Ryujinx.Core.OsHle.Objects.Time +{ + class ISystemClock : IIpcInterface + { + private Dictionary m_Commands; + + public IReadOnlyDictionary Commands => m_Commands; + + private static DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + + private SystemClockType ClockType; + + public ISystemClock(SystemClockType ClockType) + { + m_Commands = new Dictionary() + { + { 0, GetCurrentTime } + }; + + this.ClockType = ClockType; + } + + public long GetCurrentTime(ServiceCtx Context) + { + DateTime CurrentTime = DateTime.Now; + + if (ClockType == SystemClockType.User || + ClockType == SystemClockType.Network) + { + CurrentTime = CurrentTime.ToUniversalTime(); + } + + Context.ResponseData.Write((long)(DateTime.Now - Epoch).TotalSeconds); + + return 0; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Objects/Time/ITimeZoneService.cs b/Ryujinx.Core/OsHle/Objects/Time/ITimeZoneService.cs new file mode 100644 index 00000000..c083628b --- /dev/null +++ b/Ryujinx.Core/OsHle/Objects/Time/ITimeZoneService.cs @@ -0,0 +1,20 @@ +using Ryujinx.Core.OsHle.Ipc; +using System.Collections.Generic; + +namespace Ryujinx.Core.OsHle.Objects.Time +{ + class ITimeZoneService : IIpcInterface + { + private Dictionary m_Commands; + + public IReadOnlyDictionary Commands => m_Commands; + + public ITimeZoneService() + { + m_Commands = new Dictionary() + { + //... + }; + } + } +} \ No newline at end of file diff --git a/Ryujinx.Core/OsHle/Objects/Time/SystemClockType.cs b/Ryujinx.Core/OsHle/Objects/Time/SystemClockType.cs new file mode 100644 index 00000000..f447ca1c --- /dev/null +++ b/Ryujinx.Core/OsHle/Objects/Time/SystemClockType.cs @@ -0,0 +1,9 @@ +namespace Ryujinx.Core.OsHle.Objects.Time +{ + enum SystemClockType + { + User, + Network, + Local + } +} \ No newline at end of file -- cgit v1.2.3