Re: [PATCH 9/9] rust: time: add ktime_get_real_seconds
From: FUJITA Tomonori
Date: Fri Oct 30 2026 - 20:40:20 EST
On Fri, 30 Oct 2026 11:59:24 -0700
Boqun Feng <boqun@xxxxxxxxxx> wrote:
> The way I see it is from kernel::time perspective, we still want to make
> sure the APIs are still in the same abstraction layer, a
> ktime_get_real_seconds() co-exists with Instant::now() as the public
> interface layer breaks that in my opinion. And the generic type
> parameter should be flexible enough to avoid introduce anything we don't
> have a user yet.
OK. I sent a series that adds a unit parameter to `Instant` and a
seconds based `Instant` on top of it, with `Sub` and the other
arithmetic on `Instant<C, Nsec>` only:
https://lore.kernel.org/rust-for-linux/20261031003334.4161188-1-tomo@xxxxxxxxxxxx/
What it costs is a new trait `InstantUnit` with a read function, a
second method on `ClockId`, and per-unit invariants on
`Instant`. Please take a look and tell me if this is fine.