diff options
author | Lioncash <mathew1800@gmail.com> | 2020-07-15 18:30:06 -0400 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2020-07-15 18:54:15 -0400 |
commit | 8b50c660dfce50a07c2b2aa3c1b6b8642259a944 (patch) | |
tree | 798b0427a660bf249311f3a13d96c6df69a6bcb5 /src/core/core_timing.cpp | |
parent | 263200f982f1c8509450721cf5fa9d8639c198ef (diff) |
core_timing: Make use of std::chrono with ScheduleEvent
Diffstat (limited to 'src/core/core_timing.cpp')
-rw-r--r-- | src/core/core_timing.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index a63e604610..a5d084e084 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -53,7 +53,7 @@ void CoreTiming::ThreadEntry(CoreTiming& instance) { instance.ThreadLoop(); } -void CoreTiming::Initialize(std::function<void(void)>&& on_thread_init_) { +void CoreTiming::Initialize(std::function<void()>&& on_thread_init_) { on_thread_init = std::move(on_thread_init_); event_fifo_id = 0; shutting_down = false; @@ -106,11 +106,11 @@ bool CoreTiming::HasPendingEvents() const { return !(wait_set && event_queue.empty()); } -void CoreTiming::ScheduleEvent(s64 ns_into_future, const std::shared_ptr<EventType>& event_type, - u64 userdata) { +void CoreTiming::ScheduleEvent(std::chrono::nanoseconds ns_into_future, + const std::shared_ptr<EventType>& event_type, u64 userdata) { { std::scoped_lock scope{basic_lock}; - const u64 timeout = static_cast<u64>(GetGlobalTimeNs().count() + ns_into_future); + const u64 timeout = static_cast<u64>((GetGlobalTimeNs() + ns_into_future).count()); event_queue.emplace_back(Event{timeout, event_fifo_id++, userdata, event_type}); |