---
name: "time"
section: "9freebsd"
platform: "linux"
package: "freebsd-manpages"
version: "12.2-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/boottime/9freebsd"
---

# time(9freebsd)

system time variables

Part of [boottime(9freebsd)](/boottime/9freebsd.md).

## 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 system boot time.

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.

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