Merge tag 'x86_cache_for_v6.10_rc1' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-block.git] / rust / kernel / time.rs
1 // SPDX-License-Identifier: GPL-2.0
2
3 //! Time related primitives.
4 //!
5 //! This module contains the kernel APIs related to time and timers that
6 //! have been ported or wrapped for usage by Rust code in the kernel.
7
8 /// The time unit of Linux kernel. One jiffy equals (1/HZ) second.
9 pub type Jiffies = core::ffi::c_ulong;
10
11 /// The millisecond time unit.
12 pub type Msecs = core::ffi::c_uint;
13
14 /// Converts milliseconds to jiffies.
15 #[inline]
16 pub fn msecs_to_jiffies(msecs: Msecs) -> Jiffies {
17     // SAFETY: The `__msecs_to_jiffies` function is always safe to call no
18     // matter what the argument is.
19     unsafe { bindings::__msecs_to_jiffies(msecs) }
20 }