rust: time: Add ktime_get() to ClockSource trait
authorFUJITA Tomonori <fujita.tomonori@gmail.com>
Tue, 10 Jun 2025 09:32:56 +0000 (18:32 +0900)
committerAndreas Hindborg <a.hindborg@kernel.org>
Mon, 16 Jun 2025 13:02:29 +0000 (15:02 +0200)
commitcc6d1098b4cca6ec8e659de8361457c59a90b583
tree647d6bce3f674398736271d24c31370b05cec651
parent768dfbfc98e26cfad45f7165a1801d188f3cbd81
rust: time: Add ktime_get() to ClockSource trait

Introduce the ktime_get() associated function to the ClockSource
trait, allowing each clock source to specify how it retrieves the
current time. This enables Instant::now() to be implemented
generically using the type-level ClockSource abstraction.

This change enhances the type safety and extensibility of timekeeping
by statically associating time retrieval mechanisms with their
respective clock types. It also reduces the reliance on hardcoded
clock logic within Instant.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Link: https://lore.kernel.org/r/20250610093258.3435874-4-fujita.tomonori@gmail.com
Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
rust/helpers/time.c
rust/kernel/time.rs