Skip to content

Commit be8d8de

Browse files
committed
replace high_resolution_clock
1 parent a5a2d43 commit be8d8de

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Utilities/Timer.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ class Timer
66
{
77
private:
88
bool m_stopped;
9-
std::chrono::high_resolution_clock::time_point m_start;
10-
std::chrono::high_resolution_clock::time_point m_end;
9+
std::chrono::steady_clock::time_point m_start;
10+
std::chrono::steady_clock::time_point m_end;
1111

1212
public:
1313
Timer() : m_stopped(false)
@@ -17,13 +17,13 @@ class Timer
1717
void Start()
1818
{
1919
m_stopped = false;
20-
m_start = std::chrono::high_resolution_clock::now();
20+
m_start = std::chrono::steady_clock::now();
2121
}
2222

2323
void Stop()
2424
{
2525
m_stopped = true;
26-
m_end = std::chrono::high_resolution_clock::now();
26+
m_end = std::chrono::steady_clock::now();
2727
}
2828

2929
double GetElapsedTimeInSec() const
@@ -38,14 +38,14 @@ class Timer
3838

3939
u64 GetElapsedTimeInMicroSec() const
4040
{
41-
std::chrono::high_resolution_clock::time_point now = m_stopped ? m_end : std::chrono::high_resolution_clock::now();
41+
std::chrono::steady_clock::time_point now = m_stopped ? m_end : std::chrono::steady_clock::now();
4242

4343
return std::chrono::duration_cast<std::chrono::microseconds>(now - m_start).count();
4444
}
4545

4646
u64 GetElapsedTimeInNanoSec() const
4747
{
48-
std::chrono::high_resolution_clock::time_point now = m_stopped ? m_end : std::chrono::high_resolution_clock::now();
48+
std::chrono::steady_clock::time_point now = m_stopped ? m_end : std::chrono::steady_clock::now();
4949

5050
return std::chrono::duration_cast<std::chrono::nanoseconds>(now - m_start).count();
5151
}

rpcs3/Gui/ConLogFrame.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ void LogFrame::OnTimer(wxTimerEvent& event)
264264
return wxString::FromUTF8(buf.data(), size);
265265
};
266266

267-
const auto start = std::chrono::high_resolution_clock::now();
267+
const auto start = steady_clock::now();
268268

269269
// Check TTY logs
270270
while (const u64 size = std::min<u64>(sizeof(buf), m_tty_file.size() - m_tty_file.pos()))
@@ -274,7 +274,7 @@ void LogFrame::OnTimer(wxTimerEvent& event)
274274
if (get_cfg_tty()) m_tty->AppendText(text);
275275

276276
// Limit processing time
277-
if (std::chrono::high_resolution_clock::now() >= start + 4ms || text.empty()) break;
277+
if (steady_clock::now() >= start + 4ms || text.empty()) break;
278278
}
279279

280280
// Check main logs
@@ -309,6 +309,6 @@ void LogFrame::OnTimer(wxTimerEvent& event)
309309
s_gui_listener.pop();
310310

311311
// Limit processing time
312-
if (std::chrono::high_resolution_clock::now() >= start + 7ms) break;
312+
if (steady_clock::now() >= start + 7ms) break;
313313
}
314314
}

0 commit comments

Comments
 (0)