mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-12-03 03:31:27 +00:00
Fix PltSleepMs() handling of large sleep durations
This commit is contained in:
1 parent
18922a1b32
commit
2804982d91
2 files changed
+10
-3
No files matched your search
+7
-3
@@ -108,11 +108,15 @@ void PltSleepMs(int ms) {
|
|||||||
#if defined(LC_WINDOWS)
|
#if defined(LC_WINDOWS)
|
||||||
SleepEx(ms, FALSE);
|
SleepEx(ms, FALSE);
|
||||||
#elif defined(__3DS__)
|
#elif defined(__3DS__)
|
||||||
s64 nsecs = ms * 1000000;
|
s64 nsecs = (s64)ms * 1000000LL;
|
||||||
svcSleepThread(nsecs);
|
svcSleepThread(nsecs);
|
||||||
#else
|
#else
|
||||||
useconds_t usecs = ms * 1000;
|
struct timespec req;
|
||||||
usleep(usecs);
|
|
||||||
|
req.tv_sec = (time_t)(ms / 1000);
|
||||||
|
req.tv_nsec = (long)(ms % 1000) * 1000000L;
|
||||||
|
|
||||||
|
while (nanosleep(&req, &req) == -1 && errno == EINTR);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,11 +41,13 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#elif defined(__vita__)
|
#elif defined(__vita__)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <time.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <psp2/kernel/threadmgr.h>
|
#include <psp2/kernel/threadmgr.h>
|
||||||
#elif defined(__WIIU__)
|
#elif defined(__WIIU__)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <time.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
@@ -59,6 +61,7 @@
|
|||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include <time.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|||||||
Reference in new issue
Block a user