render: fix nanosec "overflow" when calculating timeout value

This commit is contained in:
Alexey Sakovets 2022-10-03 19:41:13 +03:00 committed by Daniel Eklöf
parent 2d4f0535c6
commit 37218be648
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 6 additions and 1 deletions

View file

@ -3716,7 +3716,10 @@ send_dimensions_to_client(struct terminal *term)
if (fd >= 0) {
/* Reset timeout */
const struct itimerspec timeout = {
.it_value = {.tv_sec = 0, .tv_nsec = delay_ms * 1000000},
.it_value = {
.tv_sec = delay_ms / 1000,
.tv_nsec = (delay_ms % 1000) * 1000000,
},
};
if (timerfd_settime(fd, 0, &timeout, NULL) < 0) {