TIMEVAL_TO_TIMESPEC(3)

✨ TIMEVAL_TO_TIMESPEC πŸ’–

okay bestie, so you know how the manual calls this one Library Functions Manual? yeah that's the section 3 vibe. sit down, sip your lil drink, we're converting time structures πŸ•°οΈβœ¨


🌸 NAME 🌸

TIMEVAL_TO_TIMESPEC, TIMESPEC_TO_TIMEVAL β€” convert between time structures πŸ¦‹

like literally just time-structure glow-ups in both directions, no cap.


πŸŽ€ SYNOPSIS πŸŽ€

#define _GNU_SOURCE
#include <sys/time.h>

void TIMEVAL_TO_TIMESPEC(const struct timeval *tv, struct timespec *ts);
void TIMESPEC_TO_TIMEVAL(struct timeval *tv, const struct timespec *ts);
bestie the #define _GNU_SOURCE is not optional, she's loading up the feature-test macros first, periodt ✨

πŸ’… DESCRIPTION πŸ’…

so these are macros (not functions, don't come for me πŸ™ˆ), and they do the lil switcheroo between a timeval(3type) and a timespec(3type) struct β€” and back again.

  • TIMEVAL_TO_TIMESPEC β€” takes your timeval, hands you a timespec. it's giving transformation πŸ’–
  • TIMESPEC_TO_TIMEVAL β€” takes your timespec, hands you a timeval. the reverse, iconic behavior πŸ‘‘

the way that this is especially useful? πŸ₯° it's when you're writing interfaces that receive one type but are implemented with calls to functions that receive the other one. so you're out here accepting a timeval from the world but the actual calls underneath only speak timespec, and that's fine because boom, convert, slay, carry on. no drama, no rewrites, just vibes 🌈


πŸ‘‘ STANDARDS πŸ‘‘

GNU, BSD. she's certified in multiple houses, iykyk πŸ’œ


ngl the whole page is short and sweet, which honestly? main character energy. short, useful, does exactly one thing. obsessed 🫢

okay that's the whole page!! πŸ’– this cutie came to you from Linux man-pages 6.20, dated 2025-05-17 β€” go forth and convert your time structs, bestie, you got this βœ¨πŸŽ€πŸ¦‹πŸ’…

πŸ“¦ 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