+ if (usec
< 0)
>+ usec += USEC_1S;
Doesn't this also need to do sec--; ?
>+ tv->tv_sec += sec;
>+ tv->tv_usec += usec;
>+ if (tv->tv_usec >= USEC_1S) {
>+ tv->tv_sec++;
>+ tv->tv_usec -= USEC_1S;
>+ }
>+}
Consider changing the second if() to while(), so that the function
works correctly also when adding several seconds using only the usec
parameter.
dear peter,
thanx for looking at the patch. i fixed the missing "sec--" and added
while loops. see attachment.
best regards,
andreas