xtime.tv_nsec += 1000000000 / HZ; while (xtime.tv_nsec >= 1000000000) { xtime.tv_sec++; xtime.tv_nsec -= 1000000000; }
return_value->tv_sec = xtime.tv_sec; /* timer interrupt here will lead to incorrect return value. for example, successive reads may return such times as 10.999s, 10.001s, 11.001s, .... */ return_value->tv_usec = xtime.tv_nsec / 1000;