I don't really understand how ts_remaining.tv_nsec > 1000000000
could ever be true. I thought we had a-b, with a<1000000000 and b>=0.
For the negative check, the loop should only be able to run once, so could be changed to an 'if' for clarity. Regarding the timing, branching is probably faster.
It is my understanding that the c percent operator can produce a negative number by the way, so your code wouldn't work.
could ever be true. I thought we had a-b, with a<1000000000 and b>=0.
For the negative check, the loop should only be able to run once, so could be changed to an 'if' for clarity. Regarding the timing, branching is probably faster.
It is my understanding that the c percent operator can produce a negative number by the way, so your code wouldn't work.