TIME(9)
π TIME(9) β Kernel Developer's Manual π
okay bestie, this is the Kernel Developer's Manual page for the system time variables β boottime, time_second, and time_uptime. It's giving timekeeping main character energy, and we're keeping every detail, no cap. π«Ά
β¨ NAME β¨
boottime, time_second, time_uptime β system time variables
πΈ SYNOPSIS πΈ
#include <sys/time.h>
extern struct timeval boottime;
extern time_t time_second;
extern time_t time_uptime;
π¦ DESCRIPTION π¦
First up, the icon herself: boottime. This variable holds the estimated system boot time. It's initially set when the system boots β either from the RTC, or from a time estimated from the system's root filesystem. When the current system time is set, stepped by ntpd(8), or a new time is read from the RTC as the system resumes, boottime is recomputed as new_time - uptime. The sysctl(8) kern.boottime returns this value. slay. π
The way that time_second is the system's βwall timeβ clock to the second? Iconic. β
And time_uptime is the number of seconds since boot. π°οΈ
Now for the accuracy girlies: the bintime(9), getbintime(9), microtime(9), getmicrotime(9), nanotime(9), and getnanotime(9) functions can be used to get the current time more accurately and in an atomic manner. Similarly, the binuptime(9), getbinuptime(9), microuptime(9), getmicrouptime(9), nanouptime(9), and getnanouptime(9) functions can be used to get the time elapse since boot more accurately and in an atomic manner. π₯
And yes: the boottime variable may be read and written without special precautions. It is adjusted when the phase of the system time changes. π¦
π SEE ALSO π
clock_settime(2),ntp_adjtime(2),settimeofday(2),bintime(9),binuptime(9),getbintime(9),getbinuptime(9),getmicrotime(9),getmicrouptime(9),getnanotime(9),getnanouptime(9),microtime(9),microuptime(9),nanotime(9),nanouptime(9)- Poul-Henning Kamp, βTimecounters: Efficient and precise timekeeping in SMP kernelsβ, Proceedings of EuroBSDCon 2002, Amsterdam,
/usr/share/doc/papers/timecounter.ascii.gz. - Marshall Kirk McKusick and George V. Neville-Neil, The Design and Implementation of the FreeBSD Operating System, Addison-Wesley, 57-61,65-66, July 2004.
that's the whole manual page, bestie π source/version: Debian, date: May 4, 2021, manual: TIME(9) β periodt. π«Ά
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 1994 Christopher G. Demetriou
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms