From: Alice Ryhl <aliceryhl@google.com>
To: benno.lossin@proton.me
Cc: a.hindborg@samsung.com, alex.gaynor@gmail.com,
aliceryhl@google.com, bjorn3_gh@protonmail.com,
boqun.feng@gmail.com, gary@garyguo.net, jstultz@google.com,
linux-kernel@vger.kernel.org, ojeda@kernel.org,
rust-for-linux@vger.kernel.org, sboyd@kernel.org,
tglx@linutronix.de, wedsonaf@gmail.com
Subject: Re: [PATCH v2] rust: time: add Ktime
Date: Fri, 22 Mar 2024 10:18:02 +0000 [thread overview]
Message-ID: <20240322101803.400735-1-aliceryhl@google.com> (raw)
In-Reply-To: <2ecf6529-5408-4621-becc-2f30e1039079@proton.me>
Benno Lossin <benno.lossin@proton.me> wrote:
> On 3/22/24 09:59, Alice Ryhl wrote:
>> +/// Returns the number of milliseconds between two ktimes.
>> +#[inline]
>> +pub fn ktime_ms_delta(later: Ktime, earlier: Ktime) -> i64 {
>> + (later - earlier).to_ms()
>> +}
>
> Is there a reason for this function being standalone?
I think for a Rust time API, we should make one of two choices:
* Match the C ktime_t API as closely as possible.
* Match the Rust standard library std::time API as closely as possible.
This patchset has made the former choice, and that is why I went with
this design.
In the future it could make sense to add a more "Rusty" API, but even
then I think it could make sense to have both and implement the latter
in terms of the former. That way, only the API that closely matches the
C ktime_t API needs to concern itself with unsafely calling into C.
Alice
next prev parent reply other threads:[~2024-03-22 10:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-22 8:59 Alice Ryhl
2024-03-22 9:56 ` Benno Lossin
2024-03-22 10:18 ` Alice Ryhl [this message]
2024-03-22 15:32 ` Boqun Feng
2024-03-24 9:40 ` Valentin Obst
2024-03-24 20:52 ` Boqun Feng
2024-04-10 16:57 ` Thomas Gleixner
2024-04-11 15:39 ` Miguel Ojeda
2024-04-11 15:56 ` Boqun Feng
2024-04-11 16:21 ` Alice Ryhl
2024-04-11 18:19 ` Boqun Feng
2024-04-11 21:29 ` [tip: timers/core] rust: time: Add Ktime tip-bot2 for Alice Ryhl
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=20240322101803.400735-1-aliceryhl@google.com \
--to=aliceryhl@google.com \
--cc=a.hindborg@samsung.com \
--cc=alex.gaynor@gmail.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=gary@garyguo.net \
--cc=jstultz@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=tglx@linutronix.de \
--cc=wedsonaf@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®