mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-18 01:15:46 +00:00
Use clock_gettime() for better timestamps on platforms that support it
This commit is contained in:
parent
c01deff683
commit
af6f13c7fa
@ -292,6 +292,12 @@ int PltWaitForEvent(PLT_EVENT* event) {
|
|||||||
uint64_t PltGetMillis(void) {
|
uint64_t PltGetMillis(void) {
|
||||||
#if defined(LC_WINDOWS)
|
#if defined(LC_WINDOWS)
|
||||||
return GetTickCount64();
|
return GetTickCount64();
|
||||||
|
#elif HAVE_CLOCK_GETTIME
|
||||||
|
struct timespec tv;
|
||||||
|
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &tv);
|
||||||
|
|
||||||
|
return (tv.tv_sec * 1000) + (tv.tv_nsec / 1000000);
|
||||||
#else
|
#else
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user