summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-01-25 21:56:04 -0500
committerGravatar GitHub2018-01-25 21:56:04 -0500
commit767ce8abc828e893973de9ec6b303cea31f7834f (patch)
tree6209962cde074c9435999dbeda7af9f02b9d6da1 /src
parentMerge pull request #137 from bunnei/improve-ipc (diff)
parenttime: Implement ISteadyClock::GetCurrentTimePoint. (diff)
downloadyuzu-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.cpp17
-rw-r--r--src/core/hle/service/time/time.h6
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
46class ISteadyClock final : public ServiceFramework<ISteadyClock> { 47class ISteadyClock final : public ServiceFramework<ISteadyClock> {
47public: 48public:
48 ISteadyClock() : ServiceFramework("ISteadyClock") {} 49 ISteadyClock() : ServiceFramework("ISteadyClock") {
50 static const FunctionInfo functions[] = {
51 {0, &ISteadyClock::GetCurrentTimePoint, "GetCurrentTimePoint"},
52 };
53 RegisterHandlers(functions);
54 }
55
56private:
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
51class ITimeZoneService final : public ServiceFramework<ITimeZoneService> { 66class 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 {
40static_assert(sizeof(SystemClockContext) == 0x20, 40static_assert(sizeof(SystemClockContext) == 0x20,
41 "SystemClockContext structure has incorrect size"); 41 "SystemClockContext structure has incorrect size");
42 42
43struct SteadyClockTimePoint {
44 u64 value;
45 INSERT_PADDING_WORDS(4);
46};
47static_assert(sizeof(SteadyClockTimePoint) == 0x18, "SteadyClockTimePoint is incorrect size");
48
43class Module final { 49class Module final {
44public: 50public:
45 class Interface : public ServiceFramework<Interface> { 51 class Interface : public ServiceFramework<Interface> {