mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-30 17:53:42 +01:00
Add sleep_random function for debugging purposes
This commit is contained in:
1 parent
e1e352c5b5
commit
80a11e8cbe
2 files changed
+12
No files matched your search
@@ -4,6 +4,7 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Common/Data/Random/Rng.h"
|
||||
#include "Common/Log.h"
|
||||
|
||||
#ifdef HAVE_LIBNX
|
||||
@@ -339,3 +340,11 @@ void GetCurrentTimeFormatted(char formattedTime[13]) {
|
||||
// Now tack on the milliseconds
|
||||
snprintf(formattedTime, 11, "%s:%03u", tmp, milliseconds % 1000);
|
||||
}
|
||||
|
||||
// We don't even bother synchronizing this, it's fine if threads stomp a bit.
|
||||
static GMRng g_sleepRandom;
|
||||
|
||||
void sleep_random(double minSeconds, double maxSeconds) {
|
||||
const double waitSeconds = minSeconds + (maxSeconds - minSeconds) * g_sleepRandom.F();
|
||||
sleep_precise(waitSeconds);
|
||||
}
|
||||
Reference in new issue
Block a user