diff options
| author | 2020-04-16 02:51:57 -0300 | |
|---|---|---|
| committer | 2020-04-16 02:51:57 -0300 | |
| commit | db67e017cb137376eef1930a6cc1a00c1d53acc5 (patch) | |
| tree | 06ffd00486f41314379752d5689eb6732af50c64 /src | |
| parent | Merge pull request #3689 from lioncash/unused-var (diff) | |
| parent | service: time: Implement CalculateStandardUserSystemClockDifferenceByUser. (diff) | |
| download | yuzu-db67e017cb137376eef1930a6cc1a00c1d53acc5.tar.gz yuzu-db67e017cb137376eef1930a6cc1a00c1d53acc5.tar.xz yuzu-db67e017cb137376eef1930a6cc1a00c1d53acc5.zip | |
Merge pull request #3659 from bunnei/time-calc-standard-user
service: time: Implement CalculateStandardUserSystemClockDifferenceByUser.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/time/interface.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/time/time.cpp | 23 | ||||
| -rw-r--r-- | src/core/hle/service/time/time.h | 1 |
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 | |||
| 29 | {300, &Time::CalculateMonotonicSystemClockBaseTimePoint, "CalculateMonotonicSystemClockBaseTimePoint"}, | 29 | {300, &Time::CalculateMonotonicSystemClockBaseTimePoint, "CalculateMonotonicSystemClockBaseTimePoint"}, |
| 30 | {400, &Time::GetClockSnapshot, "GetClockSnapshot"}, | 30 | {400, &Time::GetClockSnapshot, "GetClockSnapshot"}, |
| 31 | {401, &Time::GetClockSnapshotFromSystemClockContext, "GetClockSnapshotFromSystemClockContext"}, | 31 | {401, &Time::GetClockSnapshotFromSystemClockContext, "GetClockSnapshotFromSystemClockContext"}, |
| 32 | {500, nullptr, "CalculateStandardUserSystemClockDifferenceByUser"}, | 32 | {500, &Time::CalculateStandardUserSystemClockDifferenceByUser, "CalculateStandardUserSystemClockDifferenceByUser"}, |
| 33 | {501, &Time::CalculateSpanBetween, "CalculateSpanBetween"}, | 33 | {501, &Time::CalculateSpanBetween, "CalculateSpanBetween"}, |
| 34 | }; | 34 | }; |
| 35 | // clang-format on | 35 | // 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 | |||
| 308 | ctx.WriteBuffer(&clock_snapshot, sizeof(Clock::ClockSnapshot)); | 308 | ctx.WriteBuffer(&clock_snapshot, sizeof(Clock::ClockSnapshot)); |
| 309 | } | 309 | } |
| 310 | 310 | ||
| 311 | void Module::Interface::CalculateStandardUserSystemClockDifferenceByUser( | ||
| 312 | Kernel::HLERequestContext& ctx) { | ||
| 313 | LOG_DEBUG(Service_Time, "called"); | ||
| 314 | |||
| 315 | IPC::RequestParser rp{ctx}; | ||
| 316 | const auto snapshot_a = rp.PopRaw<Clock::ClockSnapshot>(); | ||
| 317 | const auto snapshot_b = rp.PopRaw<Clock::ClockSnapshot>(); | ||
| 318 | |||
| 319 | auto time_span_type{Clock::TimeSpanType::FromSeconds(snapshot_b.user_context.offset - | ||
| 320 | snapshot_a.user_context.offset)}; | ||
| 321 | |||
| 322 | if ((snapshot_b.user_context.steady_time_point.clock_source_id != | ||
| 323 | snapshot_a.user_context.steady_time_point.clock_source_id) || | ||
| 324 | (snapshot_b.is_automatic_correction_enabled && | ||
| 325 | snapshot_a.is_automatic_correction_enabled)) { | ||
| 326 | time_span_type.nanoseconds = 0; | ||
| 327 | } | ||
| 328 | |||
| 329 | IPC::ResponseBuilder rb{ctx, (sizeof(s64) / 4) + 2}; | ||
| 330 | rb.Push(RESULT_SUCCESS); | ||
| 331 | rb.PushRaw(time_span_type.nanoseconds); | ||
| 332 | } | ||
| 333 | |||
| 311 | void Module::Interface::CalculateSpanBetween(Kernel::HLERequestContext& ctx) { | 334 | void Module::Interface::CalculateSpanBetween(Kernel::HLERequestContext& ctx) { |
| 312 | LOG_DEBUG(Service_Time, "called"); | 335 | LOG_DEBUG(Service_Time, "called"); |
| 313 | 336 | ||
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: | |||
| 32 | void CalculateMonotonicSystemClockBaseTimePoint(Kernel::HLERequestContext& ctx); | 32 | void CalculateMonotonicSystemClockBaseTimePoint(Kernel::HLERequestContext& ctx); |
| 33 | void GetClockSnapshot(Kernel::HLERequestContext& ctx); | 33 | void GetClockSnapshot(Kernel::HLERequestContext& ctx); |
| 34 | void GetClockSnapshotFromSystemClockContext(Kernel::HLERequestContext& ctx); | 34 | void GetClockSnapshotFromSystemClockContext(Kernel::HLERequestContext& ctx); |
| 35 | void CalculateStandardUserSystemClockDifferenceByUser(Kernel::HLERequestContext& ctx); | ||
| 35 | void CalculateSpanBetween(Kernel::HLERequestContext& ctx); | 36 | void CalculateSpanBetween(Kernel::HLERequestContext& ctx); |
| 36 | void GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx); | 37 | void GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx); |
| 37 | 38 | ||