STRUCT TK_READ_BASE(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐Ÿ’– struct tk_read_base(9) ๐Ÿ’–

okay so this is a page from the Kernel API Manual and it's all about struct tk_read_base โ€” literally the base structure for timekeeping readout, iykyk ๐Ÿ•ฐ๏ธโœจ


๐ŸŒธ NAME ๐ŸŒธ

struct tk_read_base โ€” the base structure for timekeeping readout. that's it, that's the vibe ๐ŸŽ€


โœจ SYNOPSIS โœจ

get a load of this icon:

struct tk_read_base {
    struct clocksource      *clock;
    u64 mask;
    u64 cycle_last;
    u32 mult;
    u32 shift;
    u64 xtime_nsec;
    ktime_t base;
    u64 base_real;
 };

๐Ÿฆ‹ Members ๐Ÿฆ‹

no cap, every single field, coming right up:

  • clock โ€” the current clocksource being used for timekeeping. the main character of the time source world ๐Ÿ‘‘
  • mask โ€” the bitmask for two's complement subtraction of non-64bit clocks. lowkey essential ๐Ÿงฎ
  • cycle_last โ€” the clock cycle value at the last update. the receipts, basically ๐Ÿงพ
  • mult โ€” the (NTP adjusted) multiplier for scaled math conversion. yes bestie, NTP adjusted ๐Ÿ’…
  • shift โ€” the shift value for scaled math conversion. shifting, as one does โœจ
  • xtime_nsec โ€” the shifted (fractional) nano seconds offset for readout. fractional! fancy! ๐Ÿ“
  • base โ€” the ktime_t (nanoseconds) base time for readout โฑ๏ธ
  • base_real โ€” the nanoseconds base value for the clock REALTIME readout. REALTIME in all caps, she means it ๐Ÿ”ฅ

๐ŸŒˆ Description ๐ŸŒˆ

so this struct is 56 byte on 64 bit โ€” and together with a seqcount it occupies a single 64byte cache line. cache line efficiency? she ate. ๐Ÿ’€โœจ

the reason the struct is separate from struct timekeeper is that it's also used for the fast NMI safe accessors. multitasking queen ๐Ÿซถ

and base_real? that one exists specifically for the fast NMI safe accessor, so you can read clock realtime from any context. any context!! ๐Ÿ™ˆ๐Ÿ’œ


โญ SEE ALSO โญ

  • Kernel file ./include/linux/timekeeper_internal.h
  • struct timekeeper(9)

that's the whole page bestie, go forth and read those cycles ๐Ÿ’–๐Ÿงš

๐ŸŒท source/version and date, sign-off style: this one lives in ./include/linux, dated October 2026, and the page is struct tk_read_base(9) โ€” mwah, periodt ๐Ÿ’…๐ŸŽ€
๐Ÿ“ฆ where this page comes from