Re: [PATCH 5.14 298/334] time: Handle negative seconds correctly in timespec64_to_ns()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 16 2021 at 22:57, Arnd Bergmann wrote:
> On Thu, Sep 16, 2021 at 6:50 PM OPENSOURCE Lukas Hannen
> <lukas.hannen@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> I did stumble over one small detail:
>
>         if (ts->tv_sec <= KTIME_SEC_MIN)
>                 return KTIME_MIN;
>
> I think this is not entirely correct for the case of tv_sec==KTIME_SEC_MIN
> with a nonzero tv_nsec, as we now round down to the full second. Not sure
> if that's worth changing, as we also round up for any value between
> KTIME_SEC_MAX*NSEC_PER_SEC and KTIME_MAX, or between
> KTIME_MIN and KTIME_SEC_MIN*NSEC_PER_SEC.
> In practice I guess we care very little about the last nanosecond in the corner
> cases.

It's completely irrelevant whether the result is off by one second
related to the 292 years limit.

Thanks,

        tglx



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux