summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Locatti <reinuseslisp@airmail.cc>2020-04-16 07:51:57 +0200
committerGitHub <noreply@github.com>2020-04-16 07:51:57 +0200
commitdb67e017cb137376eef1930a6cc1a00c1d53acc5 (patch)
tree06ffd00486f41314379752d5689eb6732af50c64
parentMerge pull request #3689 from lioncash/unused-var (diff)
parentservice: time: Implement CalculateStandardUserSystemClockDifferenceByUser. (diff)
downloadyuzu-db67e017cb137376eef1930a6cc1a00c1d53acc5.tar
yuzu-db67e017cb137376eef1930a6cc1a00c1d53acc5.tar.gz
yuzu-db67e017cb137376eef1930a6cc1a00c1d53acc5.tar.bz2
yuzu-db67e017cb137376eef1930a6cc1a00c1d53acc5.tar.lz
yuzu-db67e017cb137376eef1930a6cc1a00c1d53acc5.tar.xz
yuzu-db67e017cb137376eef1930a6cc1a00c1d53acc5.tar.zst
yuzu-db67e017cb137376eef1930a6cc1a00c1d53acc5.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/time/interface.cpp2
-rw-r--r--src/core/hle/service/time/time.cpp23
-rw-r--r--src/core/hle/service/time/time.h1
3 files changed, 25 insertions, 1 deletions
diff --git a/src/core/hle/service/time/interface.cpp b/src/core/hle/service/time/interface.cpp
index f509653a3..ba8fd6152 100644
--- a/src/core/hle/service/time/interface.cpp
+++ b/src/core/hle/service/time/interface.cpp
@@ -29,7 +29,7 @@ Time::Time(std::shared_ptr<Module> module, Core::System& system, const char* nam
{300, &Time::CalculateMonotonicSystemClockBaseTimePoint, "CalculateMonotonicSystemClockBaseTimePoint"},
{400, &Time::GetClockSnapshot, "GetClockSnapshot"},
{401, &Time::GetClockSnapshotFromSystemClockContext, "GetClockSnapshotFromSystemClockContext"},
- {500, nullptr, "CalculateStandardUserSystemClockDifferenceByUser"},
+ {500, &Time::CalculateStandardUserSystemClockDifferenceByUser, "CalculateStandardUserSystemClockDifferenceByUser"},
{501, &Time::CalculateSpanBetween, "CalculateSpanBetween"},
};
// clang-format on
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp
index ce859f18d..e722886de 100644
--- a/src/core/hle/service/time/time.cpp
+++ b/src/core/hle/service/time/time.cpp
@@ -308,6 +308,29 @@ void Module::Interface::GetClockSnapshotFromSystemClockContext(Kernel::HLEReques
ctx.WriteBuffer(&clock_snapshot, sizeof(Clock::ClockSnapshot));
}
+void Module::Interface::CalculateStandardUserSystemClockDifferenceByUser(
+ Kernel::HLERequestContext& ctx) {
+ LOG_DEBUG(Service_Time, "called");
+
+ IPC::RequestParser rp{ctx};
+ const auto snapshot_a = rp.PopRaw<Clock::ClockSnapshot>();
+ const auto snapshot_b = rp.PopRaw<Clock::ClockSnapshot>();
+
+ auto time_span_type{Clock::TimeSpanType::FromSeconds(snapshot_b.user_context.offset -
+ snapshot_a.user_context.offset)};
+
+ if ((snapshot_b.user_context.steady_time_point.clock_source_id !=
+ snapshot_a.user_context.steady_time_point.clock_source_id) ||
+ (snapshot_b.is_automatic_correction_enabled &&
+ snapshot_a.is_automatic_correction_enabled)) {
+ time_span_type.nanoseconds = 0;
+ }
+
+ IPC::ResponseBuilder rb{ctx, (sizeof(s64) / 4) + 2};
+ rb.Push(RESULT_SUCCESS);
+ rb.PushRaw(time_span_type.nanoseconds);
+}
+
void Module::Interface::CalculateSpanBetween(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_Time, "called");
diff --git a/src/core/hle/service/time/time.h b/src/core/hle/service/time/time.h
index 351988468..41f3002e9 100644
--- a/src/core/hle/service/time/time.h
+++ b/src/core/hle/service/time/time.h
@@ -32,6 +32,7 @@ public:
void CalculateMonotonicSystemClockBaseTimePoint(Kernel::HLERequestContext& ctx);
void GetClockSnapshot(Kernel::HLERequestContext& ctx);
void GetClockSnapshotFromSystemClockContext(Kernel::HLERequestContext& ctx);
+ void CalculateStandardUserSystemClockDifferenceByUser(Kernel::HLERequestContext& ctx);
void CalculateSpanBetween(Kernel::HLERequestContext& ctx);
void GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx);