---
name: "timespec"
section: "3type"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/timespec/3type"
---

# timespec(3type)

time in seconds and nanoseconds

## NAME

timespec - time in seconds and nanoseconds

## LIBRARY

Standard C library (*libc*)

## SYNOPSIS

```
#include <time.h>
```

**struct timespec {**     **time\_t     tv\_sec;**   /\* Seconds \*/     /\* ... \*/  **tv\_nsec;**  /\* Nanoseconds \[**0**, **999'999'999**\] \*/ **};**

## DESCRIPTION

Describes times in seconds and nanoseconds.

*tv\_nsec* is of an implementation-defined signed type capable of holding the specified range. Under glibc, this is usually *long*, and *long long* on X32. It can be safely down-cast to any concrete 32-bit integer type for processing.

## VERSIONS

Prior to C23, *tv\_nsec* was *long*.

## STANDARDS

C11, POSIX.1-2024.

## HISTORY

POSIX.1-1996.

## NOTES

The following headers also provide this type: *\<aio.h\>*, *\<mqueue.h\>*, *\<sched.h\>*, *\<signal.h\>*, *\<sys/select.h\>*, and *\<sys/stat.h\>*.

## SEE ALSO

[**clock\_gettime**(2)](/clock_gettime/2.md), [**clock\_nanosleep**(2)](/clock_nanosleep/2.md), [**nanosleep**(2)](/nanosleep/2.md), [**timerfd\_gettime**(2)](/timerfd_gettime/2.md), [**timer\_gettime**(2)](/timer_gettime/2.md), [**time\_t**(3type)](/time_t/3type.md), [**timeval**(3type)](/timeval/3type.md)
