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

Fix abstime_from_now.

parent 32b3b4d4
Pipeline #2660 failed with stages
in 1 minute and 12 seconds
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment