From: Alice Ryhl <aliceryhl@google.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: FUJITA Tomonori <tomo@flapping.org>,
gary@garyguo.net, a.hindborg@kernel.org, ojeda@kernel.org,
acourbot@nvidia.com, anna-maria@linutronix.de,
bjorn3_gh@protonmail.com, boqun@kernel.org, dakr@kernel.org,
daniel.almeida@collabora.com, frederic@kernel.org,
jstultz@google.com, lossin@kernel.org, lyude@redhat.com,
sboyd@kernel.org, tamird@kernel.org, tglx@kernel.org,
tmgross@umich.edu, work@onurozkan.dev,
rust-for-linux@vger.kernel.org, fujita.tomonori@gmail.com
Subject: Re: [PATCH v1] rust: time: fix as_micros_ceil() to round correctly for negative Delta
Date: Tue, 14 Jul 2026 12:57:26 +0000 [thread overview]
Message-ID: <alYyNtrxK5qz7nxA@google.com> (raw)
In-Reply-To: <CANiq72mokH0-CnObPnFJWsSaofOmiAqtBuvGxPvXSruPT-Xn3g@mail.gmail.com>
On Tue, Jul 14, 2026 at 02:31:02PM +0200, Miguel Ojeda wrote:
> On Tue, Jul 14, 2026 at 2:18 PM FUJITA Tomonori <tomo@flapping.org> wrote:
> >
> > Can we agree on something like this?
>
> Something like that example is what I meant, yes (i.e. the groups with
> a comment header, the N and N + 1 thing I discussed with Andreas,
> etc.). Thanks!
>
> But timekeeping should decide to what degree `9_223_372_036_854_775`
> is meant to be documented, i.e. public, private or a middle ground
> where we only mention it to explain the boundary case without the
> intention of anyone using it.
I mean if the goal is just to explain that values that are too large
saturate, then the example could look like this?
```rs
assert_eq!(Delta::from_micros(1_000).as_nanos(), 1_000_000);
assert_eq!(Delta::from_micros(1).as_nanos(), 1_000);
assert_eq!(Delta::from_micros(-1).as_nanos(), -1_000);
// If the value is too large, the value saturates to the maximum
// possible Delta.
assert_eq!(Delta::from_micros(i64::MAX).as_nanos(), Delta::MAX);
```
This shows pretty clearly that they saturate without explaining exactly
where the boundary is.
Alice
next prev parent reply other threads:[~2026-07-14 12:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <N3Mcf328j6hi7HCJTp14HUC6-cxRUNgQLjvAdkFhIuZM-yYM91SYBYsW7kEVHRkqTzm1B3zgl5Bat4dpSIfXtA==@protonmail.internalid>
2026-07-13 22:52 ` [PATCH v1] rust: time: fix as_micros_ceil() to round correctly for negative Delta FUJITA Tomonori
2026-07-14 9:09 ` Miguel Ojeda
2026-07-14 10:16 ` FUJITA Tomonori
2026-07-14 10:38 ` Miguel Ojeda
2026-07-14 10:49 ` FUJITA Tomonori
2026-07-14 10:56 ` Gary Guo
2026-07-14 12:17 ` FUJITA Tomonori
2026-07-14 12:31 ` Miguel Ojeda
2026-07-14 12:57 ` Alice Ryhl [this message]
2026-07-14 14:21 ` Miguel Ojeda
2026-07-17 20:31 ` Andreas Hindborg
2026-07-14 12:18 ` Miguel Ojeda
2026-07-17 20:26 ` Andreas Hindborg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alYyNtrxK5qz7nxA@google.com \
--to=aliceryhl@google.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=anna-maria@linutronix.de \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=frederic@kernel.org \
--cc=fujita.tomonori@gmail.com \
--cc=gary@garyguo.net \
--cc=jstultz@google.com \
--cc=lossin@kernel.org \
--cc=lyude@redhat.com \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=tamird@kernel.org \
--cc=tglx@kernel.org \
--cc=tmgross@umich.edu \
--cc=tomo@flapping.org \
--cc=work@onurozkan.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.