mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Hindborg <a.hindborg@kernel.org>
To: FUJITA Tomonori <tomo@flapping.org>
Cc: fujita.tomonori@gmail.com, frederic@kernel.org, lyude@redhat.com,
	tglx@kernel.org, anna-maria@linutronix.de, jstultz@google.com,
	sboyd@kernel.org, ojeda@kernel.org, gary@garyguo.net,
	bjorn3_gh@protonmail.com, lossin@kernel.org,
	aliceryhl@google.com, tmgross@umich.edu, dakr@kernel.org,
	boqun@kernel.org, daniel.almeida@collabora.com,
	tamird@kernel.org, acourbot@nvidia.com, work@onurozkan.dev,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] rust: time: implement `Display` for `Delta`
Date: Wed, 04 Nov 2026 11:07:42 +0100	[thread overview]
Message-ID: <8733tgnc41.fsf@t14s.mail-host-address-is-not-set> (raw)
In-Reply-To: <20261104.180854.547774168466136920.tomo@flapping.org>

"FUJITA Tomonori" <tomo@flapping.org> writes:

> On Tue, 03 Nov 2026 16:23:40 +0100
> Andreas Hindborg <a.hindborg@kernel.org> wrote:
>
>> Implement the `Display` trait for `Delta` so that it can be displayed by a
>> formatter.
>
> [...]
>
>> - Drop the `rnull` user, which will call `Delta::as_nanos` instead (Gary).
>
> Now that the rnull user has been dropped, I wonder if we need this
> now.
>
> If we want a readable format with a unit, Debug might be a better fit.
> core::time::Duration implements only Debug, not Display, and its Debug
> output includes the unit (e.g. 1.5s). Debug output is not expected to
> be stable, so we could change the format later. Users that need a
> fixed format can use as_nanos(), like rnull does.
>
> What do you think?

I think consensus on v1 was that a `Display` implementation would be
good to have even though no user, which is why I decided to send this
again.

I do think it is nice to have, but maybe we should consider doing some
kind of intelligent selection of the unit with rounding?

We can also change it to be a `Debug` implementation. I was not aware
about the stability requirement. But I guess that is mostly a user space
thing? In the kernel we can change stuff as we see fit, as long as we do
not interfere with the uapi.


Best regards,
Andreas Hindborg



      reply	other threads:[~2026-11-04 10:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 15:23 Andreas Hindborg
2026-11-04  9:08 ` FUJITA Tomonori
2026-11-04 10:07   ` Andreas Hindborg [this message]

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=8733tgnc41.fsf@t14s.mail-host-address-is-not-set \
    --to=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.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=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=lyude@redhat.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 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®