MICROTIME(9)
π MICROTIME(9) π
okay bestie, this is a section 9 kernel dev page (that's the Kernel Developer's Manual, iykyk) and it's all about β¨getting the current timeβ¨. Six little functions, all serving the same cunty purpose, just different flavours of it.
πΈ NAME πΈ
bintime, getbintime, microtime, getmicrotime, nanotime, getnanotime β get the current time π
β¨ SYNOPSIS β¨
#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 π
So here's the tea, bestie. π΅
bintime() and getbintime() store the system time as a struct bintime at the address you give them in bt. microtime() and getmicrotime() do the exact same little job but they record the time as a struct timeval instead. And nanotime() and getnanotime()? Yeah they're storing the time as a struct timespec. Same energy, different struct. π
Now here's the part that matters:
bintime(),microtime(), andnanotime()always query the timecounter, so you get the current time as precisely as possible. No cap. πgetbintime(),getmicrotime(), andgetnanotime()are the abstractions β they return a time that's less precise but faster to obtain. Tradeoff queen behaviour. π¦
And the whole intent of the get-flavoured ones? It's to enforce the user's preference for timer accuracy versus execution time. Like, you said you wanted speed over precision, so bestie, the kernel is respecting that. π«Ά
π SEE ALSO π
binuptime(9)getbinuptime(9)getmicrouptime(9)getnanouptime(9)microuptime(9)nanouptime(9)tvtohz(9)
(go read those too, they're the uptime girlies π)
π 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. iconic lineage honestly, they've been serving since forever πβ¨
β AUTHORS β
This manual page was written by Kelly Yancey <kbyanc@posi.net>. tysm queen π
π and that's the whole page, no skips, no crumbs left behind
Debian β’ September 16, 2004 β’ MICROTIME(9) β mwah, love u, go read binuptime(9) next ππ¦πΈ
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2000 Kelly Yancey
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms