Re: [Patch 1/7] timespec diff utility

Shailabh Nagar
2006-02-27T08:34:30Z

Arjan van de Ven wrote:

>>+/*
>>+ * timespec_diff_ns - Return difference of two timestamps in nanoseconds
>>+ * In the rare case of @end being earlier than @start, return zero
>>+ */
>>+static inline nsec_t timespec_diff_ns(struct timespec *start, struct timespec *end)
>>+{
>>+ nsec_t ret;
>>+
>>+ ret = (nsec_t)(end->tv_sec - start->tv_sec)*NSEC_PER_SEC;
>>+ ret += (nsec_t)(end->tv_nsec - start->tv_nsec);
>>+ if (ret < 0)
>>+ return 0;
>>+ return ret;
>>+}
>> #endif /* __KERNEL__ */
>>
>>
>>
>
>wouldn't it be more useful to have this return a timespec as well, and
>then it'd be generically useful (and it also probably should then be
>uninlined ;)
>
>
Return another timespec to store the difference of two input timespecs ?
Would that be useful ?
Didn't quite get it.

--Shailabh