MICROUPTIME(9)
π MICROUPTIME(9) π
okay bestie, so this is the microuptime family of kernel functions from the Kernel Developer's Manual β yes, the manual is literally called MICROUPTIME(9), iconic name, no notes. it's all about asking the kernel "hey how long has it been since we booted??" and getting an answer back in whatever time format you vibe with. πΈ
β¨ SYNOPSIS β¨
#include <sys/time.h>
void
binuptime(struct bintime *bt);
void
getbinuptime(struct bintime *bt);
void
microuptime(struct timeval *tv);
void
getmicrouptime(struct timeval *tv);
void
nanouptime(struct timespec *ts);
void
getnanouptime(struct timespec *tsp);
sbintime_t
sbinuptime(void);
sbintime_t
getsbinuptime(void);
π¦ DESCRIPTION π¦
so basically, every single one of these is giving "time elapsed since boot" energy. they just format it differently, and some of them are the β¨preciseβ¨ girlies while others are the β¨fastβ¨ girlies. let's break it down:
binuptime()andgetbinuptime()β these two store the time elapsed since boot as astruct bintime, and they put it at the address thatbtpoints to. πmicrouptime()andgetmicruoptime()... wait no,getmicrouptime()β same whole entire job, but they record the elapsed time as astruct timevalinstead. different format, same truth.nanouptime()andgetnanouptime()β you already know the pattern, bestie. these store the elapsed time as astruct timespec. one takests, the other takestsp(yes they're spelled differently, don't come for me, that's just how it is π ).sbinuptime()andgetsbinuptime()β these two just straight up return the time elapsed since boot as ansbintime_t. no pointer, no address, just vibes and a return value. periodt.
π₯ the precision girlies vs. the speed girlies π₯
okay this is the part that actually matters, so listen up:
binuptime(),microuptime(),nanouptime(), andsbinuptime()β these always query the timecounter, so you get the current time as precisely as possible. they're the ones doing the full glam routine. πgetbinuptime(),getmicrouptime(),getnanouptime(), andgetsbinuptime()β these are abstractions that return a less precise, but faster to obtain, time. they're the "good enough, I'm running late" option. πββοΈπ¨
ngl, the whole point of the get-prefixed ones is to enforce the user's preference for timer accuracy versus execution time. so like, the system has a setting, and these respect it. you get what you asked for, bestie. π«Ά
π SEE ALSO π
bintime(9)get_cyclecount(9)getbintime(9)getmicrotime(9)getnanotime(9)microtime(9)nanotime(9)tvtohz(9)
π AUTHORS π
this manual page was written by Kelly Yancey <kbyanc@posi.net>. absolute legend behavior, we love to see it. π
and that's the whole page, bestie!! this came to you from the Debian edition of the Kernel Developer's Manual, dated February 21, 2015, filed under MICROUPTIME(9) β go forth and measure your uptime with confidence. mwah. π
β¨π
π¦ 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