/* This function should be only used for timestamps returned by current_kernel_time() or CURRENT_TIME, not with do_gettimeofday() because it doesn't handle the better resolution of the latter.  */
struct timespec timespec_trunc(struct timespec t, unsigned gran)
/* This function should be only used for timestamps returned by current_kernel_time() or CURRENT_TIME, not with do_gettimeofday() because it doesn't handle the better resolution of the latter.  */
struct timespec timespec_trunc(struct timespec t, unsigned gran)
{
	if (gran <= jiffies_to_usecs(1) * 1000) {
	} else if (gran == 1000000000) {
		t.tv_nsec = 0;
	} else {
		t.tv_nsec -= t.tv_nsec % gran;
	}
	return t;
}