timespec(3type)

✨ timespec β€” your girl's guide to time in seconds AND nanoseconds πŸ’…

okay so bestie, welcome to timespec(3type), the manual page itself 🌸 this is a 3type page, which means it's all about a type you can use in your C code, and I'm about to make it make sense. no cap.


πŸ“š LIBRARY

Standard C library (that's libc, queen πŸ‘‘)


πŸŽ€ SYNOPSIS

#include <time.h>

struct timespec {
    time_t     tv_sec;   /* Seconds */
    /* ... */  tv_nsec;  /* Nanoseconds [0, 999'999'999] */
};

πŸ’– DESCRIPTION

So like, a timespec describes times in seconds and nanoseconds. That's the whole vibe. Seconds + nanoseconds, together, holding hands 🫢

Now let's talk tv_nsec, because she's the interesting one. She's of an implementation-defined signed type capable of holding the specified range. Under glibc, this is usually long, and on X32 it's long long. The good news? It can be safely down-cast to any concrete 32-bit integer type for processing. So you can go ahead and narrow her down, she won't break, it's chill 😌

ngl the "implementation-defined" part is the important bit β€” don't go assuming she's always the exact same type everywhere, because she is not πŸ’€

🌈 VERSIONS

Prior to C23, tv_nsec was long. so bestie if you're reading old code, that's the tea β˜•


⭐ STANDARDS

C11, POSIX.1-2024. she's got credentials, periodt πŸ’…βœ¨


πŸ¦‹ HISTORY

POSIX.1-1996. vintage. iconic. she's been around πŸ‘‘


πŸ‘‘ NOTES

The following headers also provide this type, so you might get timespec even if you didn't ask for it directly β€” sneaky little fairy 🧚:

  • <aio.h>
  • <mqueue.h>
  • <sched.h>
  • <signal.h>
  • <sys/select.h>
  • <sys/stat.h>

πŸ”₯ SEE ALSO


okay that's the whole page and you ATE it πŸ’– this little gem comes from Linux man-pages 6.20, dated 2026-02-08 β€” go forth and measure some nanoseconds, bestie, I'm obsessed πŸŽ€βœ¨

πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ“œ the page's license: Linux-man-pages-copyleft
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms