fix incorrect timeout microsecond computation

This commit is contained in:
Chris Lee 2021-04-14 23:38:36 +02:00
parent 6b127f9661
commit 7232feee5a

View file

@ -131,7 +131,8 @@ struct timeval *get_duration_to_next_timer_expiration()
next_timer->expiration_time_ms_,
next_timer->period_ms_);
result.tv_sec = duration / 1000;
result.tv_usec = 1000 * (duration - result.tv_sec);
duration -= result.tv_sec * 1000;
result.tv_usec = 1000 * duration;
return &result;
}