diff options
| author | Lioncash <mathew1800@gmail.com> | 2020-07-15 19:14:21 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2020-07-15 19:41:22 -0400 |
| commit | 56054fe86da988527e5ffa977b0b8124d407dc4a (patch) | |
| tree | 2e46f404c3f0baf1b854e1bea916c19469fe424a /src/core/core_timing.cpp | |
| parent | 9e113a2b67cc3585e622c37f3dab06521c9ec3e9 (diff) | |
core_timing: Make TimedCallback take std::chrono::nanoseconds
Enforces our desired time units directly with a concrete type.
Diffstat (limited to 'src/core/core_timing.cpp')
| -rw-r--r-- | src/core/core_timing.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index a5d084e084..b5feb3f241 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -58,7 +58,7 @@ void CoreTiming::Initialize(std::function<void()>&& on_thread_init_) { event_fifo_id = 0; shutting_down = false; ticks = 0; - const auto empty_timed_callback = [](u64, s64) {}; + const auto empty_timed_callback = [](u64, std::chrono::nanoseconds) {}; ev_lost = CreateEvent("_lost_event", empty_timed_callback); if (is_multicore) { timer_thread = std::make_unique<std::thread>(ThreadEntry, std::ref(*this)); @@ -195,8 +195,9 @@ std::optional<s64> CoreTiming::Advance() { event_queue.pop_back(); basic_lock.unlock(); - if (auto event_type{evt.type.lock()}) { - event_type->callback(evt.userdata, global_timer - evt.time); + if (const auto event_type{evt.type.lock()}) { + event_type->callback( + evt.userdata, std::chrono::nanoseconds{static_cast<s64>(global_timer - evt.time)}); } basic_lock.lock(); |
