Skip to content

Commit

Permalink
Timer: Fix >1 second sleeps on MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Nov 24, 2024
1 parent ff01068 commit affbdfc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/common/timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ void Timer::NanoSleep(std::uint64_t ns)
// Round down to the next millisecond.
usleep(static_cast<useconds_t>((ns / 1000000) * 1000));
#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);
#endif
}
Expand Down

0 comments on commit affbdfc

Please sign in to comment.