Re: [PATCH net-next v3 2/8] rust: time: Introduce Delta type

From: Alice Ryhl
Date: Wed Oct 16 2024 - 04:24:21 EST


On Wed, Oct 16, 2024 at 5:53 AM FUJITA Tomonori
<fujita.tomonori@xxxxxxxxx> wrote:
>
> Introduce a type representing a span of time. Define our own type
> because `core::time::Duration` is large and could panic during
> creation.
>
> time::Ktime could be also used for time duration but timestamp and
> timedelta are different so better to use a new type.
>
> i64 is used instead of u64 to represent a span of time; some C drivers
> uses negative Deltas and i64 is more compatible with Ktime using i64
> too (e.g., ktime_[us|ms]_delta() APIs return i64 so we create Delta
> object without type conversion.

Is there a reason that Delta wraps i64 directly instead of wrapping
the Ktime type? I'd like to see the reason in the commit message.

Alice