TS2TIMO(9)
π TS2TIMO(9) π
okay bestie, welcome to the Kernel Developer's Manual β yes that's the manual name, and yes you're gonna read it. this one's about ts2timo, and honestly? she's lowkey iconic. β¨
πΈ NAME πΈ
ts2timo β convert time interval to tick count. that's it. that's the whole vibe. time β‘οΈ ticks. π°οΈβ‘οΈβ
π¦ SYNOPSIS π¦
like, literally just:
#include <sys/timevar.h>
int
ts2timo(clock_id clock_id, int flags, struct timespec *ts, int *timo,
struct timespec *start);
copy it exactly, don't be weird about it. π«Ά
π DESCRIPTION π
okay so here's the tea: ts2timo() takes the time interval you specified in ts and converts it into the integral number of system ticks that would elapse β and yes, that includes the current tick, she's thorough π
β then plops the result right into timo.
the interval type is specified in the flags argument, and it can be either TIMER_ABSTIME or TIMER_RELTIME. pick your fighter. βοΈ
if the interval is specified as an absolute time, then the clock_id clock is used to calculate the corresponding relative time. math era fr fr.
and if the start argument is not NULL, then the current time for the clock_id clock gets placed in that argument. free real estate. π
π₯ RETURN VALUES π₯
on success, ts2timo() returns 0 and places the computed number of ticks in the integer referenced by timo. slay. π
on failure? buckle up:
- returns
ETIMEDOUTif the interval computed was0or negative π - returns
EINVALif thets->tv_nsecfield is out of range, or theclock_idargument is invalid, or if computing the relative time from a supplied absolute value would cause an arithmetic overflow π
ngl bestie, thoseEINVALconditions are not a vibe. check yourtv_nsecrange and yourclock_idbefore you come crying to me. π
π SEE ALSO π
go read those too, iykyk π§
π HISTORY π
the ts2timo function first appeared in NetBSD 7.0. a legend was born. β
~ and that's the whole page, bestie ~ this cutie came to you from the Debian edition, dated May 22, 2013, and honestly she still ate. periodt. π ππ¦
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2013 Christos Zoulas
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms