Re: [PATCH net-next v3 3/8] rust: time: Change output of Ktime's sub operation to Delta
From: FUJITA Tomonori <fujita.tomonori@gmail.com>
Date: 2024-10-17 09:17:25
Also in:
lkml, rust-for-linux
From: FUJITA Tomonori <fujita.tomonori@gmail.com>
Date: 2024-10-17 09:17:25
Also in:
lkml, rust-for-linux
On Wed, 16 Oct 2024 13:03:48 -0700 Boqun Feng [off-list ref] wrote:
quoted
impl core::ops::Sub for Ktime { - type Output = Ktime; + type Output = Delta; #[inline] - fn sub(self, other: Ktime) -> Ktime { - Self { - inner: self.inner - other.inner, + fn sub(self, other: Ktime) -> Delta { + Delta { + nanos: self.inner - other.inner,My understanding is that ktime_t, when used as a timestamp, can only have a value in range [0, i64::MAX], so this substraction here never overflows, maybe we want add a comment here?
Sure, I'll add.