STRUCT SCM_TIMESTAMPING(9)
π 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
- 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