tree-wide: use usec_add() and usec_sub_unsigned()

This commit is contained in:
Yu Watanabe
2021-03-05 07:10:08 +09:00
parent e6283cbf48
commit 496db33004
14 changed files with 30 additions and 36 deletions
+3 -3
View File
@@ -440,11 +440,11 @@ int acquire_terminal(
assert(ts != USEC_INFINITY);
n = now(CLOCK_MONOTONIC);
if (ts + timeout < n)
n = usec_sub_unsigned(now(CLOCK_MONOTONIC), ts);
if (n >= timeout)
return -ETIMEDOUT;
r = fd_wait_for_event(notify, POLLIN, ts + timeout - n);
r = fd_wait_for_event(notify, POLLIN, usec_sub_unsigned(timeout, n));
if (r < 0)
return r;
if (r == 0)