summaryrefslogtreecommitdiff
path: root/src/core/core_timing.cpp
diff options
context:
space:
mode:
authorGravatar LC2020-10-20 22:08:53 -0400
committerGravatar GitHub2020-10-20 22:08:53 -0400
commit2e74b79e89fe1e6a21fe0d8650844e563b3c32f5 (patch)
tree0dbc65ac86e609ae22087c7be9d4759ac6b73004 /src/core/core_timing.cpp
parentkernel: Fix build with recent compiler flag changes (diff)
parentRevert "core: Fix clang build" (diff)
downloadyuzu-2e74b79e89fe1e6a21fe0d8650844e563b3c32f5.tar.gz
yuzu-2e74b79e89fe1e6a21fe0d8650844e563b3c32f5.tar.xz
yuzu-2e74b79e89fe1e6a21fe0d8650844e563b3c32f5.zip
Merge pull request #4814 from yuzu-emu/revert-4796-clang
Revert "core: Fix clang build"
Diffstat (limited to 'src/core/core_timing.cpp')
-rw-r--r--src/core/core_timing.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index 9b01f6293..e6c8461a5 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -140,8 +140,7 @@ void CoreTiming::AddTicks(u64 ticks) {
140void CoreTiming::Idle() { 140void CoreTiming::Idle() {
141 if (!event_queue.empty()) { 141 if (!event_queue.empty()) {
142 const u64 next_event_time = event_queue.front().time; 142 const u64 next_event_time = event_queue.front().time;
143 const u64 next_ticks = 143 const u64 next_ticks = nsToCycles(std::chrono::nanoseconds(next_event_time)) + 10U;
144 static_cast<u64>(nsToCycles(std::chrono::nanoseconds(next_event_time))) + 10;
145 if (next_ticks > ticks) { 144 if (next_ticks > ticks) {
146 ticks = next_ticks; 145 ticks = next_ticks;
147 } 146 }
@@ -188,7 +187,7 @@ void CoreTiming::RemoveEvent(const std::shared_ptr<EventType>& event_type) {
188 187
189std::optional<s64> CoreTiming::Advance() { 188std::optional<s64> CoreTiming::Advance() {
190 std::scoped_lock lock{advance_lock, basic_lock}; 189 std::scoped_lock lock{advance_lock, basic_lock};
191 global_timer = static_cast<u64>(GetGlobalTimeNs().count()); 190 global_timer = GetGlobalTimeNs().count();
192 191
193 while (!event_queue.empty() && event_queue.front().time <= global_timer) { 192 while (!event_queue.empty() && event_queue.front().time <= global_timer) {
194 Event evt = std::move(event_queue.front()); 193 Event evt = std::move(event_queue.front());
@@ -202,11 +201,11 @@ std::optional<s64> CoreTiming::Advance() {
202 } 201 }
203 202
204 basic_lock.lock(); 203 basic_lock.lock();
205 global_timer = static_cast<u64>(GetGlobalTimeNs().count()); 204 global_timer = GetGlobalTimeNs().count();
206 } 205 }
207 206
208 if (!event_queue.empty()) { 207 if (!event_queue.empty()) {
209 const auto next_time = static_cast<s64>(event_queue.front().time - global_timer); 208 const s64 next_time = event_queue.front().time - global_timer;
210 return next_time; 209 return next_time;
211 } else { 210 } else {
212 return std::nullopt; 211 return std::nullopt;
@@ -241,14 +240,14 @@ std::chrono::nanoseconds CoreTiming::GetGlobalTimeNs() const {
241 if (is_multicore) { 240 if (is_multicore) {
242 return clock->GetTimeNS(); 241 return clock->GetTimeNS();
243 } 242 }
244 return CyclesToNs(static_cast<s64>(ticks)); 243 return CyclesToNs(ticks);
245} 244}
246 245
247std::chrono::microseconds CoreTiming::GetGlobalTimeUs() const { 246std::chrono::microseconds CoreTiming::GetGlobalTimeUs() const {
248 if (is_multicore) { 247 if (is_multicore) {
249 return clock->GetTimeUS(); 248 return clock->GetTimeUS();
250 } 249 }
251 return CyclesToUs(static_cast<s64>(ticks)); 250 return CyclesToUs(ticks);
252} 251}
253 252
254} // namespace Core::Timing 253} // namespace Core::Timing