fix: handle precision_ms >= 1000 in delay_worker nanosleep (tv_nsec overflow)

This commit is contained in:
Rongsong Shen 2026-05-07 09:12:10 +00:00
parent 6d4d8eb81d
commit 0107828a77

View file

@ -19,7 +19,11 @@ static void* delay_worker(void* args)
pthread_testcancel();
{
struct timespec ts = { 0, (long)mgr->precision_ms * 1000000L };
long ms = (long)mgr->precision_ms;
struct timespec ts = {
.tv_sec = ms / 1000,
.tv_nsec = (ms % 1000) * 1000000L,
};
nanosleep(&ts, NULL);
}