diff options
author | bunnei <bunneidev@gmail.com> | 2020-04-15 04:28:41 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2020-04-15 04:28:41 +0200 |
commit | eb676c343a65cb182d011645d12825712e468aba (patch) | |
tree | f974073b6e8143ba1139d7c5db78dab84a5f34d4 /src/core/hle/service/time/time.cpp | |
parent | Merge pull request #3636 from ReinUsesLisp/drop-vk-hpp (diff) | |
download | yuzu-eb676c343a65cb182d011645d12825712e468aba.tar yuzu-eb676c343a65cb182d011645d12825712e468aba.tar.gz yuzu-eb676c343a65cb182d011645d12825712e468aba.tar.bz2 yuzu-eb676c343a65cb182d011645d12825712e468aba.tar.lz yuzu-eb676c343a65cb182d011645d12825712e468aba.tar.xz yuzu-eb676c343a65cb182d011645d12825712e468aba.tar.zst yuzu-eb676c343a65cb182d011645d12825712e468aba.zip |
Diffstat (limited to 'src/core/hle/service/time/time.cpp')
-rw-r--r-- | src/core/hle/service/time/time.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
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"); |