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

Andreas Hindborg <[email protected]>
Newsgroups org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
"Miguel Ojeda" <[email protected]> writes:

> On Tue, Jul 14, 2026 at 2:57 PM Alice Ryhl <[email protected]> wrote:
>>
>> I mean if the goal is just to explain that values that are too large
>> saturate, then the example could look like this?
>
> Yeah, that is what I meant by the 2) group, i.e. I think saturation
> should be shown one way or another.
>
> But the boundary case in particular is separate, and a previous patch
> showcased the actual boundary (i.e. both N and N + 1). If the docs
> mention it (as they do now), then I am OK with the boundary case being
> in the example too, even if we may not have a `pub const`, or in
> `#[test]`.
>
> Either way, what I really want is to have the basic examples landed
> and the fix... we can discuss the boundary (docs, examples, `#[test]`s
> and `pub const`s) separately. :)
>

We can land the fix first and the examples and tests later.

I agree with the suggestions made in this thread about examples and
cases. Let's have the example like Alice suggest and then test boundary
inputs in `#[test]` kunit tests. Define the magic numbers as named
constants local to the test scope, not as part of the exported API.

Best regards,
Andreas Hindborg
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.