timespec64_add_safe(9)
π timespec64_add_safe(9) π
ok so this is a page from the Kernel API Manual (the 9 section, kernel-level stuff, iykyk) and bestie, we're talking about timespec64_add_safe β the function that adds two timespec64 values together and checks that nothing overflows. It's giving careful queen energy. β¨
β¨ SYNOPSIS β¨
struct timespec64 timespec64_add_safe (const struct timespec64 lhs ,
const struct timespec64 rhs );
that's it. two timespec64s in, one struct timespec64 out. slay.
π ARGUMENTS π
lhsβ the first (left)timespec64you're adding. the left one. the main character of the addition, lowkey.rhsβ the second (right)timespec64you're adding. it's the right-hand side, no cap.
π DESCRIPTION π
okay so here's the vibe check: this function assumes both values are valid (>= 0). and it also assumes each timespec64 is in normalized form before it even touches them. so like. do your homework first, bestie. π«Ά
it adds them and does a safety check for overflow β hence the _safe in the name. the audacity of overflow to even try π not on her watch.
πΈ RETURN πΈ
the sum of lhs + rhs. that's the whole personality. π
π¦ SEE ALSO π¦
it lives in the kernel file ./kernel/time/time.c β cute. and here's the whole friend group, fr fr:
jiffies_to_msecs(9)jiffies_to_usecs(9)mktime64(9)set_normalized_timespec64(9)ns_to_timespec64(9)__msecs_to_jiffies(9)__usecs_to_jiffies(9)timespec64_to_jiffies(9)jiffies_to_timespec64(9)jiffies_to_clock_t(9)clock_t_to_jiffies(9)jiffies_64_to_clock_t(9)nsec_to_clock_t(9)jiffies64_to_nsecs(9)jiffies64_to_msecs(9)nsecs_to_jiffies64(9)nsecs_to_jiffies(9)get_timespec64(9)put_timespec64(9)get_old_timespec32(9)put_old_timespec32(9)get_itimerspec64(9)put_itimerspec64(9)get_old_itimerspec32(9)put_old_itimerspec32(9)
that's the whole page bestie, no crumbs left π this one's filed under ./kernel/time, dated October 2026, and it's literally called timespec64_add_safe(9) β go add some timespecs, safely. ππ§
π¦ 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