rust: time: Introduce Instant type
authorFUJITA Tomonori <fujita.tomonori@gmail.com>
Wed, 23 Apr 2025 19:28:54 +0000 (04:28 +0900)
committerAndreas Hindborg <a.hindborg@kernel.org>
Tue, 29 Apr 2025 13:31:07 +0000 (15:31 +0200)
commitddc671506458849c1a1c882208bbffed033e770c
tree5fb4c1589941abe1db5d01757b8a424ab2b48595
parentfae0cdc12340ce402a4681dba0f357b05d167d00
rust: time: Introduce Instant type

Introduce a type representing a specific point in time. We could use
the Ktime type but C's ktime_t is used for both timestamp and
timedelta. To avoid confusion, introduce a new Instant type for
timestamp.

Rename Ktime to Instant and modify their methods for timestamp.

Implement the subtraction operator for Instant:

Delta = Instant A - Instant B

Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Fiona Behrens <me@kloenk.dev>
Tested-by: Daniel Almeida <daniel.almeida@collabora.com>
Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Link: https://lore.kernel.org/r/20250423192857.199712-5-fujita.tomonori@gmail.com
Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
rust/kernel/time.rs