ntp_clear(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… ntp_clear(9)

okay so this is a page from the Kernel API Manual, and it's about ntp_clear β€” yes bestie, the (9) means it's a kernel function, not a command you type at your shell, so don't go trying it in the terminal, iykyk 😭


✨ NAME ✨

ntp_clear β€” clears the NTP state and sets the clocksource quantisation adjustment. two jobs, one function, main character energy fr πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

void ntp_clear (unsigned int tkid , s64 cs_tick_adj );

🌸 ARGUMENTS 🌸

  • tkid β€” the Timekeeper ID. that's it, that's the whole vibe πŸŽ€
  • cs_tick_adj β€” the per-second adjustment, measured in ns << NTP_SCALE_SHIFT. yes the shift is part of the deal, don't skip it ✨

πŸ’– DESCRIPTION πŸ’–

okay so here's the tea β˜• the timekeeping core uses a whole integer number of cycles (cycle_interval) per NTP interval. sounds fine right? but nope β€” because of that, the real time that interval represents can differ from the nominal NTP_INTERVAL_LENGTH by up to half a counter period. half! a whole half! 😭

so what this function does is fold that fixed offset straight into cs_tick_adj, which makes it an explicit part of the tick_length computation over in ntp.c β€” instead of it getting quietly applied during timekeeping accumulation, where the NTP code literally never saw it πŸ™ˆ like, the NTP code was just out here living its life with no idea. not anymore.

and just like ntp_tick_adj, this whole thing stays internal to the kernel β€” it's giving secretive, it's giving private. userspace still only sees the nominal tick via adjtimex, no cap. 🫢

good news though: NTP keeps its full symmetric Β±MAXFREQ range around that corrected base rate, so nothing gets clipped πŸ’œ

when does it get called? whenever the clocksource is (re)configured β€” which just so happens to also be exactly when the rest of the NTP state has to be cleared. so the two get done together, obviously. why do one thing when you can slay two at once βœ¨πŸ‘‘


πŸ”₯ SEE ALSO πŸ”₯

go read those too, bestie, they're all connected πŸ¦‹


<div>⭐ and that's the whole page! straight outta ./kernel/time, dated October 2026, and yeah β€” it's ntp_clear(9), we been knew πŸ’–βœ¨πŸŽ€</div>

πŸ“¦ where this page comes from