time(7)
๐ time(7) โ the whole vibe of time & timers, explained by your fav Unix bestie ๐
okay so bestie, welcome to time(7) from the Miscellaneous Information Manual โ this is the overview of time and timers page. it's giving "everything you never asked about how computers feel time passing" and honestly? it's iconic. no cap. let's get into it ๐ฐ๏ธโจ
๐ธ DESCRIPTION ๐ธ
๐ฉท Real time and process time
okay so real time is time measured from some fixed point โ either a standard point way back in the past (that's the Epoch and calendar time, we'll get there bb) or from some point in the life of a process, like its start. that second one? that's elapsed time. ๐ซถ
Process time is a whole different girl: it's the amount of CPU time used by a process. and sometimes we split it into user and system components:
- User CPU time โ the time spent executing code in user mode. main character hours.
- System CPU time โ the time the kernel spends executing in system mode on behalf of the process (like, executing system calls). the kernel is literally doing stuff for you and it counts.
the time(1) command can be used to figure out how much CPU time got consumed while a program ran. and if a program wants to know how much CPU time it's eaten, it can use times(2), getrusage(2), or clock(3). slay. ๐
๐ The hardware clock
most computers have a (battery-powered!) hardware clock, and the kernel reads it at boot time to initialize the software clock. so it's like the alarm clock that wakes the computer up into knowing what time it is. for further deets, see rtc(4) and hwclock(8). ๐
โฑ๏ธ The software clock, HZ, and jiffies
this is the part where things get spicy. ๐ถ๏ธ
the accuracy of various system calls that set timeouts โ like select(2) and sigtimedwait(2) โ and measure CPU time โ like getrusage(2) โ is limited by the resolution of the software clock. that's a clock the kernel maintains, and it measures time in jiffies. the size of a jiffy is determined by the value of the kernel constant HZ.
and HZ? bestie, HZ is not consistent. it varies across kernel versions and hardware platforms. on i386 it goes like this:
- on kernels up to and including Linux 2.4.x,
HZwas100, giving a jiffy value of0.01seconds - starting with Linux 2.6.0,
HZwas raised to1000, giving a jiffy of0.001seconds
since Linux 2.6.13, the HZ value is a kernel configuration parameter and can be 100, 250 (the default) or 1000, yielding a jiffies value of, respectively, 0.01, 0.004, or 0.001 seconds. three options, all valid, all serving cunt. ๐
since Linux 2.6.20, a further frequency is available: 300 โ a number that divides evenly for the common video frame rates (PAL, 25 Hz; NTSC, 30 Hz). she was made for the screens. ๐
watch out bestie, thetimes(2)system call is a special case. it reports times with a granularity defined by the kernel constantUSER_HZ. user-space applications can determine the value of this constant usingsysconf(_SC_CLK_TCK).
๐ฆ System and process clocks; time namespaces
the kernel supports a whole range of clocks that measure various kinds of elapsed and virtual (i.e., consumed CPU) time. these clocks are described in clock_gettime(2). a few of the clocks are settable using clock_settime(2). and the values of certain clocks are virtualized by time namespaces โ see time_namespaces(7). it's giving multiverse energy fr fr. ๐
โจ High-resolution timers
before Linux 2.6.21, the accuracy of timer and sleep system calls (see below, bb) was also limited by the size of the jiffy. so yeah, everything was jiffy-coded. ๐ญ
since Linux 2.6.21, Linux supports high-resolution timers (HRTs), optionally configurable via CONFIG_HIGH_RES_TIMERS. on a system that supports HRTs, the accuracy of sleep and timer system calls is no longer constrained by the jiffy โ instead it can be as accurate as the hardware allows (microsecond accuracy is typical of modern hardware, which is lowkey incredible ๐).
you can determine whether high-resolution timers are supported by:
- checking the resolution returned by a call to
clock_getres(2), or - looking at the
"resolution"entries in/proc/timer_list
HRTs are not supported on all hardware architectures. (support is provided on x86, ARM, and PowerPC, among others.) so vibe check your arch first, bestie.
๐ The Epoch
UNIX systems represent time in seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). that's the moment everything starts counting from. the origin story. the big bang but make it POSIX. โญ
a program can determine the calendar time via the clock_gettime(2) CLOCK_REALTIME clock, which returns time (in seconds and nanoseconds) that have elapsed since the Epoch. time(2) provides similar information, but only with accuracy to the nearest second โ so she's the less precise sister, we still love her. ๐ the system time can be changed using clock_settime(2).
๐ Broken-down time
certain library functions use a structure of type tm to represent broken-down time โ it stores the time value separated out into distinct components (year, month, day, hour, minute, second, etc.). so instead of one big scary number, you get little labeled boxes. organized queen. ๐๏ธ
this structure is described in tm(3type), which also describes functions that convert between calendar time and broken-down time. and the functions for converting between broken-down time and printable string representations of the time are described in ctime(3), strftime(3), and strptime(3). ๐
๐ด Sleeping and setting timers
various system calls and functions allow a program to sleep (suspend execution) for a specified period of time โ see nanosleep(2), clock_nanosleep(2), and sleep(3). nap time, but make it syscalls. ๐
and various system calls allow a process to set a timer that expires at some point in the future, and optionally at repeated intervals โ see alarm(2), getitimer(2), timerfd_create(2), and timer_create(2). set it and forget it, but the kernel remembers. โฐ
๐ซถ Timer slack
since Linux 2.6.28, it is possible to control the "timer slack" value for a thread. the timer slack is the length of time by which the kernel may delay the wake-up of certain system calls that block with a timeout. permitting this delay allows the kernel to coalesce wake-up events, thus possibly reducing the number of system wake-ups and saving power. ๐ฑ
for more details, see the description of PR_SET_TIMERSLACK in prctl(2). it's basically the kernel saying "girl, I'll get to it, let me batch these". ๐
๐ฅ SEE ALSO ๐ฅ
date(1), time(1), timeout(1), adjtimex(2), alarm(2), clock_gettime(2), clock_nanosleep(2), getitimer(2), getrlimit(2), getrusage(2), gettimeofday(2), nanosleep(2), stat(2), time(2), timer_create(2), timerfd_create(2), times(2), utime(2), adjtime(3), clock(3), clock_getcpuclockid(3), ctime(3), ntp_adjtime(3), ntp_gettime(3), pthread_getcpuclockid(3), sleep(3), strftime(3), strptime(3), timeradd(3), usleep(3), rtc(4), time_namespaces(7), hwclock(8)
and that's the whole page bestie, you ate that ๐๐
Linux man-pages version 6.20, dated 2026-02-08 โ that's the source and the date of this lil time(7) masterpiece, mwah, stan, see you in the next manpage ๐โจ๐
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: Linux-man-pages-copyleft
- Copyright 2006, Michael Kerrisk <mtk.manpages@gmail.com>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms