Fix PltSleepMs() handling of large sleep durations

This commit is contained in:
Cameron Gutman committed 2026-11-12 23:48:29 -06:00
1 parent 18922a1b32
commit 2804982d91
2 files changed
+10 -3

No files matched your search

+7 -3
View File
@@ -108,11 +108,15 @@ void PltSleepMs(int ms) {
#if defined(LC_WINDOWS)
SleepEx(ms, FALSE);
#elif defined(__3DS__)
s64 nsecs = ms * 1000000;
s64 nsecs = (s64)ms * 1000000LL;
svcSleepThread(nsecs);
#else
useconds_t usecs = ms * 1000;
usleep(usecs);
struct timespec req;
req.tv_sec = (time_t)(ms / 1000);
req.tv_nsec = (long)(ms % 1000) * 1000000L;
while (nanosleep(&req, &req) == -1 && errno == EINTR);
#endif
}
+3
View File
@@ -41,11 +41,13 @@
#include <fcntl.h>
#elif defined(__vita__)
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <psp2/kernel/threadmgr.h>
#elif defined(__WIIU__)
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <malloc.h>
@@ -59,6 +61,7 @@
#else
#include <unistd.h>
#include <pthread.h>
#include <time.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <arpa/inet.h>