msecs_to_jiffies(9)
π msecs_to_jiffies β a Kernel API Manual moment
okay so bestie, welcome to msecs_to_jiffies(9), straight out of the Kernel API Manual β¨ this is the little function that turns your cute millisecond numbers into jiffies, and she's lowkey doing a LOT of heavy lifting behind the scenes. let's get into it π«Ά
β¨ NAME β¨
msecs_to_jiffies β convert milliseconds to jiffies π
πΈ SYNOPSIS πΈ
unsigned long msecs_to_jiffies (const unsigned int m );
π ARGUMENTS π
mβ time in milliseconds β±οΈ that's it, that's the whole input, she's simple like that
π¦ DESCRIPTION π¦
okay so the conversion is done as follows, no cap:
- negative values mean 'infinite timeout' (
MAX_JIFFY_OFFSET) βΎοΈ MAX_JIFFY_OFFSET values]mean 'infinite timeout' too π (yes bestie, that's exactly how the page says it, i'm not touching it)- all other values are converted to jiffies by either multiplying the input value by a factor or dividing it with a factor and handling any 32-bit overflows π for the details see
_msecs_to_jiffies
now the actually iconic part: msecs_to_jiffies checks for the passed in value being a constant via __builtin_constant_p allowing gcc to eliminate most of the code π₯ like she literally gets compiled away, main character energy fr.
__msecs_to_jiffies is called if the value passed does not allow constant folding and the actual conversion must be done at runtime πββοΈπ¨ and the HZ range specific helpers _msecs_to_jiffies are called both directly here and from __msecs_to_jiffies in the case where constant folding is not possible. iykyk π
β RETURN β
jiffies value π
π SEE ALSO π
- Kernel file
./include/linux/jiffies.h get_jiffies_64(9)- General information about
time_*inlines(9) time_after(9)time_before(9)time_after_eq(9)time_before_eq(9)time_in_range(9)time_in_range_open(9)time_after64(9)time_before64(9)time_after_eq64(9)time_before_eq64(9)time_in_range64(9)time_is_before_jiffies(9)time_is_before_jiffies64(9)time_is_after_jiffies(9)time_is_after_jiffies64(9)time_is_before_eq_jiffies(9)time_is_before_eq_jiffies64(9)time_is_after_eq_jiffies(9)time_is_after_eq_jiffies64(9)jiffies_to_msecs(9)jiffies_to_usecs(9)jiffies_to_nsecs(9)secs_to_jiffies(9)usecs_to_jiffies(9)
like she has a whole friend group, we love a connected queen π§ββοΈπ
and that's the whole page bestie, mwah π this one lives in ./include/linux and the version stamp says October 2026 β so yeah, future icon behavior, periodt πβ¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms