btest.c
void timespec_diff(struct timespec *start, struct timespec *stop,
                   struct timespec *result)
{
	if ((stop->tv_nsec - start->tv_nsec) < 0) {
		result->tv_sec = stop->tv_sec - start->tv_sec - 1;
		result->tv_nsec = stop->tv_nsec - start->tv_nsec + 1000000000;
	} else {
		result->tv_sec = stop->tv_sec - start->tv_sec;
		result->tv_nsec = stop->tv_nsec - start->tv_nsec;
	}

	return;
}
/* Calculate the difference between two timespec's */
Calculate the difference between two timespec's
Calculate the difference between two timespec ' s
void timespec_diff(struct timespec *start, struct timespec *stop,
                   struct timespec *result)
{
	if ((stop->tv_nsec - start->tv_nsec) < 0) {
		result->tv_sec = stop->tv_sec - start->tv_sec - 1;
		result->tv_nsec = stop->tv_nsec - start->tv_nsec + 1000000000;
	} else {
		result->tv_sec = stop->tv_sec - start->tv_sec;
		result->tv_nsec = stop->tv_nsec - start->tv_nsec;
	}
	return;
}
void timespec_diff ( struct timespec * start , struct timespec * stop , struct timespec * result ) { if ( ( stop -> tv_nsec - start -> tv_nsec ) < 0 ) { result -> tv_sec = stop -> tv_sec - start -> tv_sec - 1 ; result -> tv_nsec = stop -> tv_nsec - start -> tv_nsec + 1000000000 ; } else { result -> tv_sec = stop -> tv_sec - start -> tv_sec ; result -> tv_nsec = stop -> tv_nsec - start -> tv_nsec ; } return ; }
Calculate the difference between two timespec's
Calculate the difference between two timespec ' s