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

# times(3)

process times

## NAME

**times** – process times

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

**#include \<sys/times.h\>**

*clock\_t*\

**times**(*struct tms \*tp*);

## DESCRIPTION

This interface is obsoleted by [getrusage(2)](/getrusage/2.md) and [gettimeofday(2)](/gettimeofday/2.md).

The **times**() function returns the value of time in CLK\_TCK's of a second since the system startup time. The current value of CLK\_TCK, the frequency of the statistics clock in ticks per second, may be obtained through the [sysconf(3)](/sysconf/3.md) interface.

It also fills in the structure pointed to by *tp* with time-accounting information.

The *tms* structure is defined as follows:

```
struct tms {
	clock_t tms_utime;
	clock_t tms_stime;
	clock_t tms_cutime;
	clock_t tms_cstime;
};
```

The elements of this structure are defined as follows:

- *tms\_utime*

  The CPU time charged for the execution of user instructions.

- *tms\_stime*

  The CPU time charged for execution by the system on behalf of the process.

- *tms\_cutime*

  The sum of the *tms\_utime*s and *tms\_cutime*s of the child processes.

- *tms\_cstime*

  The sum of the *tms\_stime*s and *tms\_cstime*s of the child processes.

All times are in CLK\_TCK's of a second.

The times of a terminated child process are included in the *tms\_cutime* and *tms\_cstime* elements of the parent when one of the [wait(2)](/wait/2.md) functions returns the process ID of the terminated child to the parent. If an error occurs, **times**() returns the value ((*clock\_t*)-1), and sets *errno* to indicate the error.

## ERRORS

The **times**() function may fail and set the global variable *errno* for any of the errors specified for the library routines [getrusage(2)](/getrusage/2.md) and [gettimeofday(2)](/gettimeofday/2.md).

## SEE ALSO

[time(1)](/time/1.md), [getrusage(2)](/getrusage/2.md), [gettimeofday(2)](/gettimeofday/2.md), [wait(2)](/wait/2.md), [sysconf(3)](/sysconf/3.md), [clocks(7)](/clocks/7.md)

## STANDARDS

The **times**() function conforms to IEEE Std 1003.1-1988 (“POSIX.1”).
