Re: [PATCH v1] rust: time: fix as_micros_ceil() to round correctly for negative Delta

Miguel Ojeda <[email protected]>
Newsgroups org.kernel.vger.rust-for-linux
Message-ID <CANiq72mtS0ABA2JnT5tpz6J9c_mnxY+vyPvghV_ukngWvN8F2w@mail.gmail.com>
On Fri, Jul 17, 2026 at 10:31 PM Andreas Hindborg <[email protected]> wrote:
>
> Acked-by: Andreas Hindborg <[email protected]>
>
> @Miguel, can you take this with rust fixes?

Thanks for taking a look even on holidays -- on it.

By the way, apart from this fix, for the positive side, reading on the
doctests we were discussing, if we want:

  +    /// // One past the boundary: saturates.
  +    /// assert_eq!(Delta::from_micros(MAX_MICROS + 1),
Delta::from_nanos(i64::MAX));

Then do we want `Delta::from_micros(MAX_MICROS + 1).as_micros_ceil()`
to return `MAX_MICROS` or `MAX_MICROS + 1`?

The docs seem to imply `MAX_MICROS + 1` but we return `MAX_MICROS`.

Cheers,
Miguel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.