msecs_to_jiffies(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 🌈

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