timecounter_cyc2time(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ timecounter_cyc2time β€” Kernel API Manual ✨

okay bestie, welcome to timecounter_cyc2time(9) πŸ’– this is the little Kernel API Manual page that teaches you how to turn a cycle counter reading into the same time base as the values timecounter_read() gives you. it's giving "time travel but make it nanoseconds" πŸ•°οΈβœ¨


🌸 NAME 🌸

timecounter_cyc2time β€” convert a cycle counter to same time base as values returned by timecounter_read()

like literally, that's the whole job. it takes a cycle count and lines it up with the same clock vibe as timecounter_read()'s output 🫢


πŸŽ€ SYNOPSIS πŸŽ€

u64 timecounter_cyc2time (const struct timecounter *tc , u64
cycle_tstamp );

that's the signature, copy it exactly, no cap πŸ’…


πŸ’« ARGUMENTS πŸ’«

  • tc β€” Pointer to time counter. that's your const struct timecounter *, the main character of this whole operation πŸ‘‘
  • cycle_tstamp β€” a value returned by tc->cc->read. yes, exactly that, don't improvise πŸ™ˆ

πŸ”₯ DESCRIPTION πŸ”₯

so here's the tea β˜• cycle counts that are converted correctly as long as they fall into the interval [-1/2 max cycle count, +1/2 max cycle count], with "max cycle count" == cs->mask+1.

read that again, because the range is the whole plot twist 😭 it's centered on zero, half the max in each direction, cs->mask+1 wide in total.

and why do we care? because this allows conversion of cycle counter values which were generated in the past. like, values from before the initial time stamp. retroactive glow-up ✨ this is literally the function's whole personality.


⭐ RETURN ⭐

cycle counter converted to nanoseconds since the initial time stamp 🌈

yep. nanoseconds. since the initial time stamp. that's the return value, an u64, no cap 🫢


πŸ¦‹ SEE ALSO πŸ¦‹

go read the whole squad, they're all iconic πŸ’œ


that's the page bestie!! every flag, every value, every path β€” all of it, untouched, just with way more sparkle πŸŽ€πŸ’…

signed off with love from the ./include/linux directory, vintage October 2026, source/version timecounter_cyc2time(9) β€” mwah πŸ’‹

πŸ“¦ where this page comes from