STRUCT SCM_TIMESTAMPING(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct scm_timestamping(9) β€” from the Kernel API Manual, bestie

okay so picture this: you're deep in the kernel docs, the manual is literally called Kernel API Manual, and you open up struct scm_timestamping(9). that's our girl. she's not complicated, she's just specific, and we're gonna get into it. πŸŽ€


✨ NAME ✨

struct scm_timestamping β€” timestamps exposed through cmsg. that's the whole vibe. timestamps, but delivered via cmsg, iykyk. ⭐


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the actual shape of her, and yes, we're keeping every character, no cap:

struct scm_timestamping {
  #ifdef __KERNEL__;
    struct __kernel_old_timespec ts[3];
  #else;
    struct timespec ts[3];
  #endif;
 };

look at that conditional. she's showing one face to the kernel and another to user space. main character energy honestly. πŸ‘‘


🌸 Members 🌸

(this section is literally empty on the page β€” nothing listed, no members spelled out, just the heading sitting there. we love a minimalist moment. πŸ’…)


πŸ’– Description πŸ’–

so here's the tea. the timestamping interfaces SO_TIMESTAMPING and MSG_TSTAMP_* communicate network timestamps by passing this struct inside a cmsg with recvmsg. that's the whole delivery mechanism β€” struct goes in the cmsg, timestamp arrives, slay. πŸš€

for the full details, the page points you at Documentation/networking/timestamping.rst. go read it, it's giving lore. πŸ“–

now the tricky part, and you need to hear this one: user space sees a timespec definition that matches either __kernel_timespec or __kernel_old_timespec. in the kernel, we require two structure definitions to provide both. so yeah β€” two definitions, both required, because the kernel has to serve both flavors. not me having to juggle two entire struct definitions for one struct's sake 😭 literally the most try-hard part of the whole thing and I respect it.

🫢 reminder: none of this is optional flavor text β€” the #ifdef __KERNEL__ split in the synopsis is exactly why the description talks about two structure definitions. one struct, two faces, both required.

πŸ”₯ SEE ALSO πŸ”₯

  • Kernel file ./include/uapi/linux/errqueue.h β€” go look, that's where she lives. ✨

and that's the page!! 🌈 this iconic little entry ships out of ./include/uapi/linux, dated October 2026, and it's filed under struct scm_timestamping(9). mwah, go timestamp something, bestie πŸ’œπŸ“πŸ§š

πŸ“¦ where this page comes from