kernel::time - Rust
Skip to main content Module time kernel Module time Source Expand description Time related primitives. This module contains the kernel APIs related to time and timers that have been ported or wrapped for usage by Rust code in the kernel. There are two types in this module: The Instant type represents a specific point in time. The Delta type represents a span of time. Note that the C side uses ktime_t type to represent both.
However, timestamp and timedelta are different. To avoid confusion, we use two different types. A Instant object can be created by calling the Instant::now() function. It represents a point in time at which the object was created. By calling the Instant::elapsed() method, a Delta object representing the elapsed time can be created. The Delta object can also be created by subtracting two Instant objects. A Delta type supports methods to retrieve the duration in various units.
C header: include/linux/jiffies.h . C header: include/linux/ktime.h . Modules § delay Delay and sleep primitives. hrtimer Intrusive high resolution timers. Structs § Boot Time A monotonic that ticks while system is suspended. Delta A span of time. Instant A specific point in time. Monotonic A monotonically increasing clock. Real Time A settable system-wide clock that measures real (i.e., wall-clock) time. Tai International Atomic Time.
Enums § Jiffy A time unit of jiffies. Nsec A time unit of nanoseconds. Sec A time unit of seconds. Constants § NSEC_ PER_ MSEC The number of nanoseconds per millisecond. NSEC_ PER_ SEC The number of nanoseconds per second. NSEC_ PER_ USEC The number of nanoseconds per microsecond. Traits § ClockId Trait for kernel clock identifiers. Instant Unit A trait for time units that can be used with Instant . Time Unit A trait for time units.
Functions § msecs_ to_ jiffies Converts milliseconds to jiffies. Type Aliases § Jiffies The time unit of Linux kernel. One jiffy equals (1/HZ) second. Msecs The millisecond time unit.