[lttng-dev] [PATCH lttng-tools 1/2] Fix: Connect timeout arithmetic in inet/inet6
Mathieu Desnoyers
mathieu.desnoyers at efficios.com
Fri Nov 9 17:41:17 EST 2018
----- On Nov 9, 2018, at 5:34 PM, Jonathan Rajotte jonathan.rajotte-julien at efficios.com wrote:
[...]
>> +
>> +LTTNG_HIDDEN
>> +struct timespec timespec_abs_diff(struct timespec t1, struct timespec t2)
>> +{
>> + uint64_t ts1 = (uint64_t) t1.tv_sec * INT64_C(1000000000) + (uint64_t)
>> t1.tv_nsec;
>> + uint64_t ts2 = (uint64_t) t2.tv_sec * INT64_C(1000000000) + (uint64_t)
>> t2.tv_nsec;
>
> Use NSEC_PER_SEC here.
>
>> + uint64_t diff = max(ts1, ts2) - min(ts1, ts2);
>> + struct timespec res;
>> +
>> + res.tv_sec = diff / INT64_C(1000000000);
>
> Use NSEC_PER_SEC here.
>
>> + res.tv_nsec = diff % INT64_C(1000000000);
>
> Use NSEC_PER_SEC here.
Fixing in v2, thanks,
Mathieu
>
>> + return res;
>> +}
>> --
>> 2.11.0
>>
>
> --
> Jonathan Rajotte-Julien
> EfficiOS
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list