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

# hardclock(9)

real-time timer

## NAME

**hardclock** – real-time timer

## SYNOPSIS

*void*\

**hardclock**(*int cnt*, *int usermode*);

## DESCRIPTION

The **hardclock**() function is called periodically based on pending work. The rate ranges from *hz* times per second on a very busy system, to twice a second on an idle system. The *cnt* argument reports an estimate of the number of ticks since the last call. Over long timescales, the average sum of *cnt* over one second is *hz*. See [hz(9)](/hz/9.md) for important details over shorter time scales. The *usermode* argument is non-zero when **hardclock**() is called from an context that interrupted usermode execution.

**hardclock**() may perform different tasks such as:

- Run the current process's virtual and profile time (decrease the corresponding timers, if they are activated, and generate SIGVTALRM or SIGPROF, respectively).

- Increment the time-of-day, taking care of any [ntpd(8)](/ntpd/8.md) or [adjtime(2)](/adjtime/2.md) induced changes and leap seconds, as well as any necessary compensations to keep in sync with PPS signals or external clocks, if supported by the kernel.

- Schedule softclock interrupts( [swi(9)](/swi/9.md)) processing.

- Collect [hwpmc(4)](/hwpmc/4.md) statistics.

- Do device polling, when enabled( see [polling(4)](/polling/4.md)).

- Implement software [watchdog(9)](/watchdog/9.md) processing.

- Enqueue [epoch(9)](/epoch/9.md) processing.

## SEE ALSO

[adjtime(2)](/adjtime/2.md), [ntp\_adjtime(2)](/ntp_adjtime/2.md), [signal(3)](/signal/3.md), [hwpmc(4)](/hwpmc/4.md), [polling(4)](/polling/4.md), [ntpd(8)](/ntpd/8.md), [epoch(9)](/epoch/9.md), [eventtimers(9)](/eventtimers/9.md), [hz(9)](/hz/9.md), [swi(9)](/swi/9.md), [watchdog(9)](/watchdog/9.md)
