Re: [Y2038] [PATCH] hil_mlc: convert timeval to timespec64

From: Pingbo Wen
Date: Fri Oct 23 2015 - 08:35:28 EST



> 在 2015年10月23日,17:45,Arnd Bergmann <arnd@xxxxxxxx> 写道:
>
> On Friday 23 October 2015 17:12:38 Pingbo Wen wrote:
>> On Monday, October 19, 2015 04:58 PM, Arnd Bergmann wrote:
>>>> - do_gettimeofday(&tv);
>>>> -
> Handling the jiffies overflow is trivially done through the time_before()
> and time_after() helpers, like
>
>
> start = jiffies;
> ...
> now = jiffies;
> timeout = start + HZ * timeout_usec / USEC_PER_SEC;
> if (time_after(now, start + timeout_jiffies)
> timeout();
> else
> mod_timer(timer, start + timeout_jiffies);
>
> The time_after function works because unsigned overflow is well-defined
> in C (unlike signed overflow).
>

Make sense, I will try this in next version.

Thanks,
Pingbo

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/