Re: [PATCH v1] rust: time: fix as_micros_ceil() to round correctly for negative Delta
FUJITA Tomonori <[email protected]>
| Newsgroups | org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <[email protected]> |
On Sat, 18 Jul 2026 19:23:19 +0200 Miguel Ojeda <[email protected]> wrote: > 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`. You are right. I've just a fix. I didn't include test in the patch, but I'll send a follow-up patch adding examples and tests for rust-next.