Commit 335eee9a authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Fix abstime_from_now.

parent 32b3b4d4
Loading
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -16,8 +16,11 @@ struct timespec abstime_from_now(uint32_t wait_time) {
    struct timespec deadline;
    uint32_t diff_s = wait_time / 1000000;
    uint32_t diff_ns = (wait_time % 1000000) * 1000;
    deadline.tv_sec = diff_s + now.tv_sec;
    deadline.tv_nsec = diff_ns + now.tv_nsec;
    __syscall_slong_t sum = diff_ns + now.tv_nsec;
    __syscall_slong_t carry = (sum) / 1000000000;
    __syscall_slong_t rest = (sum) % 1000000000;
    deadline.tv_sec = diff_s + now.tv_sec + carry;
    deadline.tv_nsec = rest;
    return deadline;
}