Timer: Fix >1 second sleeps on MacOS
This commit is contained in:
parent
ff010686f8
commit
affbdfc350
|
@ -395,7 +395,7 @@ void Timer::NanoSleep(std::uint64_t ns)
|
||||||
// Round down to the next millisecond.
|
// Round down to the next millisecond.
|
||||||
usleep(static_cast<useconds_t>((ns / 1000000) * 1000));
|
usleep(static_cast<useconds_t>((ns / 1000000) * 1000));
|
||||||
#else
|
#else
|
||||||
const struct timespec ts = {0, static_cast<long>(ns)};
|
const struct timespec ts = {static_cast<long>(ns / 1000000000ULL), static_cast<long>(ns % 1000000000ULL)};
|
||||||
nanosleep(&ts, nullptr);
|
nanosleep(&ts, nullptr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue