summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/time/interface.cpp2
-rw-r--r--src/core/hle/service/time/time.cpp27
-rw-r--r--src/core/hle/service/time/time.h1
3 files changed, 27 insertions, 3 deletions
diff --git a/src/core/hle/service/time/interface.cpp b/src/core/hle/service/time/interface.cpp
index 0bc90b183..6423a6c37 100644
--- a/src/core/hle/service/time/interface.cpp
+++ b/src/core/hle/service/time/interface.cpp
@@ -28,7 +28,7 @@ Time::Time(std::shared_ptr<Module> module, Core::System& system, const char* nam
28 {201, nullptr, "GetStandardUserSystemClockAutomaticCorrectionUpdatedTime"}, 28 {201, nullptr, "GetStandardUserSystemClockAutomaticCorrectionUpdatedTime"},
29 {300, &Time::CalculateMonotonicSystemClockBaseTimePoint, "CalculateMonotonicSystemClockBaseTimePoint"}, 29 {300, &Time::CalculateMonotonicSystemClockBaseTimePoint, "CalculateMonotonicSystemClockBaseTimePoint"},
30 {400, &Time::GetClockSnapshot, "GetClockSnapshot"}, 30 {400, &Time::GetClockSnapshot, "GetClockSnapshot"},
31 {401, nullptr, "GetClockSnapshotFromSystemClockContext"}, 31 {401, &Time::GetClockSnapshotFromSystemClockContext, "GetClockSnapshotFromSystemClockContext"},
32 {500, nullptr, "CalculateStandardUserSystemClockDifferenceByUser"}, 32 {500, nullptr, "CalculateStandardUserSystemClockDifferenceByUser"},
33 {501, nullptr, "CalculateSpanBetween"}, 33 {501, nullptr, "CalculateSpanBetween"},
34 }; 34 };
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp
index 2053fa078..6b1357813 100644
--- a/src/core/hle/service/time/time.cpp
+++ b/src/core/hle/service/time/time.cpp
@@ -242,7 +242,7 @@ void Module::Interface::CalculateMonotonicSystemClockBaseTimePoint(Kernel::HLERe
242void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) { 242void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) {
243 LOG_DEBUG(Service_Time, "called"); 243 LOG_DEBUG(Service_Time, "called");
244 IPC::RequestParser rp{ctx}; 244 IPC::RequestParser rp{ctx};
245 const auto type = rp.PopRaw<u8>(); 245 const auto type{rp.PopRaw<u8>()};
246 246
247 Clock::SystemClockContext user_context{}; 247 Clock::SystemClockContext user_context{};
248 if (const ResultCode result{ 248 if (const ResultCode result{
@@ -277,6 +277,29 @@ void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) {
277 ctx.WriteBuffer(&clock_snapshot, sizeof(Clock::ClockSnapshot)); 277 ctx.WriteBuffer(&clock_snapshot, sizeof(Clock::ClockSnapshot));
278} 278}
279 279
280void Module::Interface::GetClockSnapshotFromSystemClockContext(Kernel::HLERequestContext& ctx) {
281 LOG_DEBUG(Service_Time, "called");
282 IPC::RequestParser rp{ctx};
283 const auto type{rp.PopRaw<u8>()};
284 rp.AlignWithPadding();
285
286 const Clock::SystemClockContext user_context{rp.PopRaw<Clock::SystemClockContext>()};
287 const Clock::SystemClockContext network_context{rp.PopRaw<Clock::SystemClockContext>()};
288
289 Clock::ClockSnapshot clock_snapshot{};
290 if (const ResultCode result{GetClockSnapshotFromSystemClockContextInternal(
291 &ctx.GetThread(), user_context, network_context, type, clock_snapshot)};
292 result != RESULT_SUCCESS) {
293 IPC::ResponseBuilder rb{ctx, 2};
294 rb.Push(result);
295 return;
296 }
297
298 IPC::ResponseBuilder rb{ctx, 2};
299 rb.Push(RESULT_SUCCESS);
300 ctx.WriteBuffer(&clock_snapshot, sizeof(Clock::ClockSnapshot));
301}
302
280void Module::Interface::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) { 303void Module::Interface::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) {
281 LOG_DEBUG(Service_Time, "called"); 304 LOG_DEBUG(Service_Time, "called");
282 IPC::ResponseBuilder rb{ctx, 2, 1}; 305 IPC::ResponseBuilder rb{ctx, 2, 1};
@@ -290,7 +313,7 @@ Module::Interface::Interface(std::shared_ptr<Module> module, Core::System& syste
290Module::Interface::~Interface() = default; 313Module::Interface::~Interface() = default;
291 314
292void InstallInterfaces(Core::System& system) { 315void InstallInterfaces(Core::System& system) {
293 auto module = std::make_shared<Module>(system); 316 auto module{std::make_shared<Module>(system)};
294 std::make_shared<Time>(module, system, "time:a")->InstallAsService(system.ServiceManager()); 317 std::make_shared<Time>(module, system, "time:a")->InstallAsService(system.ServiceManager());
295 std::make_shared<Time>(module, system, "time:s")->InstallAsService(system.ServiceManager()); 318 std::make_shared<Time>(module, system, "time:s")->InstallAsService(system.ServiceManager());
296 std::make_shared<Time>(module, system, "time:u")->InstallAsService(system.ServiceManager()); 319 std::make_shared<Time>(module, system, "time:u")->InstallAsService(system.ServiceManager());
diff --git a/src/core/hle/service/time/time.h b/src/core/hle/service/time/time.h
index 0b3cda6aa..2a216701c 100644
--- a/src/core/hle/service/time/time.h
+++ b/src/core/hle/service/time/time.h
@@ -30,6 +30,7 @@ public:
30 void IsStandardNetworkSystemClockAccuracySufficient(Kernel::HLERequestContext& ctx); 30 void IsStandardNetworkSystemClockAccuracySufficient(Kernel::HLERequestContext& ctx);
31 void CalculateMonotonicSystemClockBaseTimePoint(Kernel::HLERequestContext& ctx); 31 void CalculateMonotonicSystemClockBaseTimePoint(Kernel::HLERequestContext& ctx);
32 void GetClockSnapshot(Kernel::HLERequestContext& ctx); 32 void GetClockSnapshot(Kernel::HLERequestContext& ctx);
33 void GetClockSnapshotFromSystemClockContext(Kernel::HLERequestContext& ctx);
33 void GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx); 34 void GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx);
34 35
35 private: 36 private: