Lines Matching +full:sub +full:- +full:system

1 // SPDX-License-Identifier: GPL-2.0
10 //! - The [`Instant`] type represents a specific point in time.
11 //! - The [`Delta`] type represents a span of time.
50 pub fn msecs_to_jiffies(msecs: Msecs) -> Jiffies { in msecs_to_jiffies()
78 fn ktime_get() -> bindings::ktime_t; in ktime_get()
83 /// A nonsettable system-wide clock that represents monotonic time since as
85 /// point corresponds to the number of seconds that the system has been
89 /// CLOCK_REAL (e.g., if the system administrator manually changes the
91 /// count time that the system is suspended.
99 fn ktime_get() -> bindings::ktime_t { in ktime_get()
105 /// A settable system-wide clock that measures real (i.e., wall-clock) time.
108 /// affected by discontinuous jumps in the system time (e.g., if the system
112 /// number of seconds since 1970-01-01 00:00:00 Coordinated Universal Time
126 fn ktime_get() -> bindings::ktime_t { in ktime_get()
132 /// A monotonic that ticks while system is suspended.
134 /// A nonsettable system-wide clock that is identical to CLOCK_MONOTONIC,
135 /// except that it also includes any time that the system is suspended. This
136 /// allows applications to get a suspend-aware monotonic clock without
146 fn ktime_get() -> bindings::ktime_t { in ktime_get()
154 /// A system-wide clock derived from wall-clock time but counting leap seconds.
170 fn ktime_get() -> bindings::ktime_t { in ktime_get()
189 fn clone(&self) -> Self { in clone()
199 pub fn now() -> Self { in now()
210 pub fn elapsed(&self) -> Delta { in elapsed()
211 Self::now() - *self in elapsed()
215 pub(crate) fn as_nanos(&self) -> i64 { in as_nanos()
219 /// Create an [`Instant`] from a `ktime_t` without checking if it is non-negative.
230 pub(crate) unsafe fn from_ktime(ktime: bindings::ktime_t) -> Self { in from_ktime()
242 impl<C: ClockSource> ops::Sub for Instant<C> {
247 fn sub(self, other: Instant<C>) -> Delta { in sub() method
249 value: self.inner - other.inner, in sub()
258 fn add(self, rhs: Delta) -> Self::Output { in add()
274 impl<T: ClockSource> ops::Sub<Delta> for Instant<T> {
278 fn sub(self, rhs: Delta) -> Self::Output { in sub() method
281 let res = self.inner - rhs.value; in sub()
343 pub const fn from_jiffies(jiffies: isize) -> Self { in from_jiffies()
349 pub const fn as_jiffies(self) -> isize { in as_jiffies()
358 fn add(self, rhs: Self) -> Self { in add()
372 impl ops::Sub for Delta {
376 fn sub(self, rhs: Self) -> Self::Output { in sub() method
378 value: self.value - rhs.value, in sub()
386 self.value -= rhs.value; in sub_assign()
394 fn mul(self, rhs: i64) -> Self::Output { in mul()
412 fn div(self, rhs: Self) -> Self::Output { in div()
432 pub const fn from_nanos(nanos: i64) -> Self { in from_nanos()
438 /// The `micros` can range from -9_223_372_036_854_775 to 9_223_372_036_854_775.
442 pub const fn from_micros(micros: i64) -> Self { in from_micros()
450 /// The `millis` can range from -9_223_372_036_854 to 9_223_372_036_854.
454 pub const fn from_millis(millis: i64) -> Self { in from_millis()
462 /// The `secs` can range from -9_223_372_036 to 9_223_372_036.
466 pub const fn from_secs(secs: i64) -> Self { in from_secs()
474 pub fn is_zero(self) -> bool { in is_zero()
480 pub fn is_negative(self) -> bool { in is_negative()
486 pub const fn as_nanos(self) -> i64 { in as_nanos()
493 pub fn as_micros_ceil(self) -> i64 { in as_micros_ceil()
497 // The usual `(nanos + d - 1) / d` is not used because the addition overflows in as_micros_ceil()
498 // once `nanos` exceeds `i64::MAX - (d - 1)`; saturating the addition instead in as_micros_ceil()
502 let (n, add) = if n > 0 { (n - 1, 1) } else { (n, 0) }; in as_micros_ceil()
518 pub fn as_millis(self) -> i64 { in as_millis()
534 pub fn as_millis_ceil(self) -> i64 { in as_millis_ceil()
538 // The usual `(nanos + d - 1) / d` is not used because the addition overflows in as_millis_ceil()
539 // once `nanos` exceeds `i64::MAX - (d - 1)`; saturating the addition instead in as_millis_ceil()
543 let (n, add) = if n > 0 { (n - 1, 1) } else { (n, 0) }; in as_millis_ceil()
562 pub fn rem_nanos(self, dividend: i32) -> Self { in rem_nanos()