diff options
| author | 2018-01-25 21:56:04 -0500 | |
|---|---|---|
| committer | 2018-01-25 21:56:04 -0500 | |
| commit | 767ce8abc828e893973de9ec6b303cea31f7834f (patch) | |
| tree | 6209962cde074c9435999dbeda7af9f02b9d6da1 /src | |
| parent | Merge pull request #137 from bunnei/improve-ipc (diff) | |
| parent | time: Implement ISteadyClock::GetCurrentTimePoint. (diff) | |
| download | yuzu-767ce8abc828e893973de9ec6b303cea31f7834f.tar.gz yuzu-767ce8abc828e893973de9ec6b303cea31f7834f.tar.xz yuzu-767ce8abc828e893973de9ec6b303cea31f7834f.zip | |
Merge pull request #142 from bunnei/improve-time
time: Implement ISteadyClock::GetCurrentTimePoint
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/time/time.cpp | 17 | ||||
| -rw-r--r-- | src/core/hle/service/time/time.h | 6 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp index 96ccee50d..5802f6f6c 100644 --- a/src/core/hle/service/time/time.cpp +++ b/src/core/hle/service/time/time.cpp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include <chrono> | 5 | #include <chrono> |
| 6 | #include "common/logging/log.h" | 6 | #include "common/logging/log.h" |
| 7 | #include "core/core_timing.h" | ||
| 7 | #include "core/hle/ipc_helpers.h" | 8 | #include "core/hle/ipc_helpers.h" |
| 8 | #include "core/hle/kernel/client_port.h" | 9 | #include "core/hle/kernel/client_port.h" |
| 9 | #include "core/hle/kernel/client_session.h" | 10 | #include "core/hle/kernel/client_session.h" |
| @@ -45,7 +46,21 @@ private: | |||
| 45 | 46 | ||
| 46 | class ISteadyClock final : public ServiceFramework<ISteadyClock> { | 47 | class ISteadyClock final : public ServiceFramework<ISteadyClock> { |
| 47 | public: | 48 | public: |
| 48 | ISteadyClock() : ServiceFramework("ISteadyClock") {} | 49 | ISteadyClock() : ServiceFramework("ISteadyClock") { |
| 50 | static const FunctionInfo functions[] = { | ||
| 51 | {0, &ISteadyClock::GetCurrentTimePoint, "GetCurrentTimePoint"}, | ||
| 52 | }; | ||
| 53 | RegisterHandlers(functions); | ||
| 54 | } | ||
| 55 | |||
| 56 | private: | ||
| 57 | void GetCurrentTimePoint(Kernel::HLERequestContext& ctx) { | ||
| 58 | LOG_DEBUG(Service, "called"); | ||
| 59 | SteadyClockTimePoint steady_clock_time_point{cyclesToMs(CoreTiming::GetTicks()) / 1000}; | ||
| 60 | IPC::ResponseBuilder rb{ctx, (sizeof(SteadyClockTimePoint) / 4) + 2}; | ||
| 61 | rb.Push(RESULT_SUCCESS); | ||
| 62 | rb.PushRaw(steady_clock_time_point); | ||
| 63 | } | ||
| 49 | }; | 64 | }; |
| 50 | 65 | ||
| 51 | class ITimeZoneService final : public ServiceFramework<ITimeZoneService> { | 66 | class ITimeZoneService final : public ServiceFramework<ITimeZoneService> { |
diff --git a/src/core/hle/service/time/time.h b/src/core/hle/service/time/time.h index cd936a50c..1cbbadb21 100644 --- a/src/core/hle/service/time/time.h +++ b/src/core/hle/service/time/time.h | |||
| @@ -40,6 +40,12 @@ struct SystemClockContext { | |||
| 40 | static_assert(sizeof(SystemClockContext) == 0x20, | 40 | static_assert(sizeof(SystemClockContext) == 0x20, |
| 41 | "SystemClockContext structure has incorrect size"); | 41 | "SystemClockContext structure has incorrect size"); |
| 42 | 42 | ||
| 43 | struct SteadyClockTimePoint { | ||
| 44 | u64 value; | ||
| 45 | INSERT_PADDING_WORDS(4); | ||
| 46 | }; | ||
| 47 | static_assert(sizeof(SteadyClockTimePoint) == 0x18, "SteadyClockTimePoint is incorrect size"); | ||
| 48 | |||
| 43 | class Module final { | 49 | class Module final { |
| 44 | public: | 50 | public: |
| 45 | class Interface : public ServiceFramework<Interface> { | 51 | class Interface : public ServiceFramework<Interface> { |