MICROTIME(9)

πŸ“¦
version 15.1 Β· 4 versions
, in freebsd 15.1, nixpkgs unstable

πŸ’– MICROTIME(9) πŸ’–

okay so welcome to the Kernel Developer's Manual, bestie β€” this is the MICROTIME(9) page, and it's literally all about getting the current time. πŸ•°οΈβœ¨


✨ NAME ✨

bintime, getbintime, microtime, getmicrotime, nanotime, getnanotime β€” get the current time. That's the whole assignment, no cap. πŸ’…

🌸 SYNOPSIS 🌸

First up, the include and the signatures β€” keep these exact, bestie:

#include <sys/time.h>

void
bintime(struct bintime *bt);

void
getbintime(struct bintime *bt);

void
microtime(struct timeval *tv);

void
getmicrotime(struct timeval *tv);

void
nanotime(struct timespec *ts);

void
getnanotime(struct timespec *tsp);

πŸ’… DESCRIPTION πŸ’…

okay so here's the tea, function by function:

  • bintime() and getbintime() store the system time as a struct bintime at the addresses specified by bt. 🫢
  • microtime() and getmicrotime() perform the same utility, but record the time as a struct timeval instead. ⏱️
  • similarly, nanotime() and getnanotime() store the time as a struct timespec. 🧚

Then there's the precision-vs-speed vibe check:

  • bintime(), microtime(), and nanotime() always query the timecounter to return the current time as precisely as possible. They are the main characters of accuracy. πŸ‘‘
  • getbintime(), getmicrotime(), and getnanotime() are abstractions which return a less precise, but faster to obtain, time. Lowkey the speedrun squad. πŸ”₯

The intent of getbintime(), getmicrotime(), and getnanotime() is to enforce the user's preference for timer accuracy versus execution time. It's giving "you choose the vibe: precise or quick." βš–οΈβœ¨

πŸ¦‹ SEE ALSO πŸ¦‹

πŸŽ€ HISTORY πŸŽ€

The bintime functions first appeared in FreeBSD 5.0. The microtime and nanotime functions first appeared in FreeBSD 3.0 but have existed in other incarnations since 4.4BSD. History really said "we've been doing this since forever." πŸ˜­πŸ’–

πŸ’– AUTHORS πŸ’–

This manual page was written by Kelly Yancey <kbyanc@posi.net>. Iconic behavior. 🫢


πŸŽ€ Cute little sign-off: this page's source/version is Debian, it's dated September 16, 2004, and the manual name is MICROTIME(9). Byeeee πŸ’…βœ¨

πŸ“¦ where this page comes from