---
name: "boottime"
section: "9"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/boottime"
---

# boottime(9)

system time variables

## 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

The *boottime* variable holds the estimated system boot time. This time is 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)](/ntpd/8.md), or a new time is read from the RTC as the system resumes, *boottime* is recomputed as new\_time - uptime. The [sysctl(8)](/sysctl/8.md) *kern.boottime* returns this value.

The *time\_second* variable is the system's “wall time” clock to the second.

The *time\_uptime* variable is the number of seconds since boot.

The [bintime(9)](/bintime/9.md), [getbintime(9)](/getbintime/9.md), [microtime(9)](/microtime/9.md), [getmicrotime(9)](/getmicrotime/9.md), [nanotime(9)](/nanotime/9.md), and [getnanotime(9)](/getnanotime/9.md) functions can be used to get the current time more accurately and in an atomic manner. Similarly, the [binuptime(9)](/binuptime/9.md), [getbinuptime(9)](/getbinuptime/9.md), [microuptime(9)](/microuptime/9.md), [getmicrouptime(9)](/getmicrouptime/9.md), [nanouptime(9)](/nanouptime/9.md), and [getnanouptime(9)](/getnanouptime/9.md) functions can be used to get the time elapse since boot more accurately and in an atomic manner. 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)](/clock_settime/2.md), [ntp\_adjtime(2)](/ntp_adjtime/2.md), [settimeofday(2)](/settimeofday/2.md), [bintime(9)](/bintime/9.md), [binuptime(9)](/binuptime/9.md), [getbintime(9)](/getbintime/9.md), [getbinuptime(9)](/getbinuptime/9.md), [getmicrotime(9)](/getmicrotime/9.md), [getmicrouptime(9)](/getmicrouptime/9.md), [getnanotime(9)](/getnanotime/9.md), [getnanouptime(9)](/getnanouptime/9.md), [microtime(9)](/microtime/9.md), [microuptime(9)](/microuptime/9.md), [nanotime(9)](/nanotime/9.md), [nanouptime(9)](/nanouptime/9.md) 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.
