]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: time: Make Instant generic over ClockSource
authorFUJITA Tomonori <fujita.tomonori@gmail.com>
Tue, 10 Jun 2025 09:32:55 +0000 (18:32 +0900)
committerAndreas Hindborg <a.hindborg@kernel.org>
Mon, 16 Jun 2025 13:01:56 +0000 (15:01 +0200)
commit768dfbfc98e26cfad45f7165a1801d188f3cbd81
tree876575ca9de53c7980c32cef1c20f3b1f29cddb1
parent1664a671be46a0b0daf5250eb124d94a5501a64c
rust: time: Make Instant generic over ClockSource

Refactor the Instant type to be generic over a ClockSource type
parameter, enabling static enforcement of clock correctness across
APIs that deal with time. Previously, the clock source was implicitly
fixed (typically CLOCK_MONOTONIC), and developers had to ensure
compatibility manually.

This design eliminates runtime mismatches between clock sources, and
enables stronger type-level guarantees throughout the timer subsystem.

Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Link: https://lore.kernel.org/r/20250610093258.3435874-3-fujita.tomonori@gmail.com
Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
rust/kernel/time.rs