Skip to content
Snippets Groups Projects
Commit f730dce4 authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by Daniel Almeida
Browse files

rust: time: Add PartialEq/Eq/PartialOrd/Ord trait to Ktime


Add PartialEq/Eq/PartialOrd/Ord trait to Ktime so two Ktime instances
can be compared to determine whether a timeout is met or not.

Use the derive implements; we directly touch C's ktime_t rather than
using the C's accessors because it is more efficient and we already do
in the existing code (Ktime::sub).

Reviewed-by: default avatarTrevor Gross <tmgross@umich.edu>
Reviewed-by: default avatarAlice Ryhl <aliceryhl@google.com>
Reviewed-by: default avatarGary Guo <gary@garyguo.net>
Reviewed-by: default avatarFiona Behrens <me@kloenk.dev>
Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@gmail.com>
parent 82ad3d49
Branches
Tags
Loading
...@@ -27,7 +27,7 @@ pub fn msecs_to_jiffies(msecs: Msecs) -> Jiffies { ...@@ -27,7 +27,7 @@ pub fn msecs_to_jiffies(msecs: Msecs) -> Jiffies {
/// A Rust wrapper around a `ktime_t`. /// A Rust wrapper around a `ktime_t`.
#[repr(transparent)] #[repr(transparent)]
#[derive(Copy, Clone)] #[derive(Copy, Clone, PartialEq, PartialOrd, Eq, Ord)]
pub struct Ktime { pub struct Ktime {
inner: bindings::ktime_t, inner: bindings::ktime_t,
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment