diff options
Diffstat (limited to 'src/core/core_timing.cpp')
| -rw-r--r-- | src/core/core_timing.cpp | 13 |
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) { | |||
| 140 | void CoreTiming::Idle() { | 140 | void 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 | ||
| 189 | std::optional<s64> CoreTiming::Advance() { | 188 | std::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 | ||
| 247 | std::chrono::microseconds CoreTiming::GetGlobalTimeUs() const { | 246 | std::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 |