summaryrefslogtreecommitdiff
path: root/src/core/core_timing.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2020-07-15 18:30:06 -0400
committerGravatar Lioncash2020-07-15 18:54:15 -0400
commit8b50c660dfce50a07c2b2aa3c1b6b8642259a944 (patch)
tree798b0427a660bf249311f3a13d96c6df69a6bcb5 /src/core/core_timing.cpp
parentMerge pull request #4342 from lioncash/endian (diff)
downloadyuzu-8b50c660dfce50a07c2b2aa3c1b6b8642259a944.tar.gz
yuzu-8b50c660dfce50a07c2b2aa3c1b6b8642259a944.tar.xz
yuzu-8b50c660dfce50a07c2b2aa3c1b6b8642259a944.zip
core_timing: Make use of std::chrono with ScheduleEvent
Diffstat (limited to 'src/core/core_timing.cpp')
-rw-r--r--src/core/core_timing.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index a63e60461..a5d084e08 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -53,7 +53,7 @@ void CoreTiming::ThreadEntry(CoreTiming& instance) {
53 instance.ThreadLoop(); 53 instance.ThreadLoop();
54} 54}
55 55
56void CoreTiming::Initialize(std::function<void(void)>&& on_thread_init_) { 56void CoreTiming::Initialize(std::function<void()>&& on_thread_init_) {
57 on_thread_init = std::move(on_thread_init_); 57 on_thread_init = std::move(on_thread_init_);
58 event_fifo_id = 0; 58 event_fifo_id = 0;
59 shutting_down = false; 59 shutting_down = false;
@@ -106,11 +106,11 @@ bool CoreTiming::HasPendingEvents() const {
106 return !(wait_set && event_queue.empty()); 106 return !(wait_set && event_queue.empty());
107} 107}
108 108
109void CoreTiming::ScheduleEvent(s64 ns_into_future, const std::shared_ptr<EventType>& event_type, 109void CoreTiming::ScheduleEvent(std::chrono::nanoseconds ns_into_future,
110 u64 userdata) { 110 const std::shared_ptr<EventType>& event_type, u64 userdata) {
111 { 111 {
112 std::scoped_lock scope{basic_lock}; 112 std::scoped_lock scope{basic_lock};
113 const u64 timeout = static_cast<u64>(GetGlobalTimeNs().count() + ns_into_future); 113 const u64 timeout = static_cast<u64>((GetGlobalTimeNs() + ns_into_future).count());
114 114
115 event_queue.emplace_back(Event{timeout, event_fifo_id++, userdata, event_type}); 115 event_queue.emplace_back(Event{timeout, event_fifo_id++, userdata, event_type});
116 116