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 yourtimeval, hands you atimespec. it's giving transformation πTIMESPEC_TO_TIMEVALβ takes yourtimespec, hands you atimeval. 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