CLOCKS(7)
π CLOCKS(7) β various system timers
okay so bestie, you've stumbled into clocks(7) from the Miscellaneous Information Manual and honestly? grab a lil snack, because we're about to tour every clock in BSD and they are not all the same vibe. π°οΈβ¨
NAME
clocks β various system timers π«Ά
SYNOPSIS
#include <time.h>
DESCRIPTION
okay so first thing, and this is important so read it twice: HZ is not part of the application interface in BSD. not a thing you get to touch, bestie. π
There are many different real and virtual (timekeeping) clocks with different frequencies, and they each have their own whole personality:
- The scheduling clock. This is a real clock with a frequency that happens to be
100. It is not available to applications. π ββοΈ - The statistics clock. This is a real clock with a frequency that happens to be
128. It is not directly available to applications. - The clock reported by
clock(3). This is a virtual clock with a frequency that happens to be128. Its actual frequency is given by the macroCLOCKS_PER_SEC. Note thatCLOCKS_PER_SECmay be floating point. π«§ Do not useclock(3)in new programs under FreeBSD. It is feeble compared withgetrusage(2). It is provided for ANSI conformance. It is implemented by callinggetrusage(2)and throwing away information and resolution. like, throwing it away. π - The clock reported by
times(3). This is a virtual clock with a frequency that happens to be128. Its actual frequency is given by the macroCLK_TCK(deprecated; do not use) and bysysconf(_SC_CLK_TCK)and bysysctl(3). Note that its frequency may be different fromCLOCKS_PER_SEC. Do not usetimes(3)in new programs under FreeBSD. It is feeble compared withgettimeofday(2)together withgetrusage(2). It is provided for POSIX conformance. It is implemented by callinggettimeofday(2)andgetrusage(2)and throwing away information and resolution. same tragic energy, different syscalls. π - The profiling clock. This is a real clock with frequency
1024. It is used mainly bymoncontrol(3)andgprof(1). Applications should determine its actual frequency usingsysctl(3)or by reading it from the header in the profiling data file. detective work, but make it clock. π - The mc146818a clock. This is a real clock with a nominal frequency of
32768. It is divided down to give the statistic clock and the profiling clock. It is not available to applications. it's giving backstage-only energy. π - The microseconds clock. This is a virtual clock with frequency
1000000. It is used for most timekeeping in BSD and is exported to applications ingetrusage(2),gettimeofday(2),select(2),getitimer(2), etc. This is the clock that should normally be used by BSD applications. π main character clock, no cap. - The i8254 clock. This is a real clock/timer with a nominal frequency of
1193182. It has three independent time counters to be used. It is divided down to give the scheduling clock. It is not available to applications. three counters and we get zero of them, iconic. π - The TSC clock (64-bit register) on fifth-generation or later x86 systems. This is a real clock with a frequency that is equivalent to the number of cycles per second of the CPU(s). Its frequency can be found using the
machdep.tsc_freqsysctl, if it is available. It is used to interpolate between values of the scheduling clock. It can be accessed using thePMIOTSTAMPrequest ofperfmon(4). β¨ - The ACPI clock. This is a real clock/timer with a nominal frequency of
3579545. It is accessed via a 24 or 32 bit register. Unlike the TSC clock, it maintains a constant tick rate even when the CPU sleeps or its clock rate changes. It is not available to applications. steady queen behavior, honestly. πΈ
Summary: if HZ is not 1000000 then the application is probably using the wrong clock. π¨ like please do a vibe check on your clock choice fr fr.
SEE ALSO
gprof(1), clock_gettime(2), getitimer(2), getrusage(2), gettimeofday(2), select(2), clock(3), moncontrol(3), times(3) π
AUTHORS
This manual page was written by JΓΆrg Wunsch after a description posted by Bruce Evans. π legends, both of them.
and that's the whole clock tour, bestie β this page is from Debian, dated January 18, 2008, so yeah she's an older icon but she still ate. go forth and pick the right clock this time okay? π¦β
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 1996 Joerg Wunsch
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms