- if (!divisor) {
- PARA_EMERG_LOG("%s\n", "division by zero");
- exit(EXIT_FAILURE);
- }
- q = tv->tv_usec / divisor;
- result->tv_sec = tv->tv_sec / divisor;
- result->tv_usec = (tv->tv_sec - result->tv_sec * divisor)
- * 1000 * 1000 / divisor;
- if (result->tv_usec + q >= 1000 * 1000) {
- result->tv_sec++;
- result->tv_usec = 1000 * 1000 - result->tv_usec - q;
- } else
- result->tv_usec += q;