| 1 |
.\" Copyright 2020, Michael Kerrisk <[email protected]> |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH timespec 3type 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
timespec \- time in seconds and nanoseconds |
| 9 |
.SH LIBRARY |
| 10 |
Standard C library |
| 11 |
.RI ( libc ) |
| 12 |
.SH SYNOPSIS |
| 13 |
.EX |
| 14 |
.B #include <time.h> |
| 15 |
.P |
| 16 |
.B struct timespec { |
| 17 |
.BR " time_t tv_sec;" " /* Seconds */" |
| 18 |
.RB " /* ... */" " tv_nsec;" \ |
| 19 |
" /* Nanoseconds [" 0 ", " 999\[aq]999\[aq]999 "] */" |
| 20 |
.B }; |
| 21 |
.EE |
| 22 |
.SH DESCRIPTION |
| 23 |
Describes times in seconds and nanoseconds. |
| 24 |
.P |
| 25 |
.I tv_nsec |
| 26 |
is of an implementation-defined signed type |
| 27 |
capable of holding the specified range. |
| 28 |
Under glibc, this is usually |
| 29 |
.IR long , |
| 30 |
and |
| 31 |
.I long long |
| 32 |
on X32. |
| 33 |
It can be safely down-cast to any concrete 32-bit integer type for processing. |
| 34 |
.SH VERSIONS |
| 35 |
Prior to C23, |
| 36 |
.I tv_nsec |
| 37 |
was |
| 38 |
.IR long . |
| 39 |
.SH STANDARDS |
| 40 |
C11, POSIX.1-2024. |
| 41 |
.SH HISTORY |
| 42 |
POSIX.1-1996. |
| 43 |
.SH NOTES |
| 44 |
The following headers also provide this type: |
| 45 |
.IR <aio.h> , |
| 46 |
.IR <mqueue.h> , |
| 47 |
.IR <sched.h> , |
| 48 |
.IR <signal.h> , |
| 49 |
.IR <sys/select.h> , |
| 50 |
and |
| 51 |
.IR <sys/stat.h> . |
| 52 |
.SH SEE ALSO |
| 53 |
.BR clock_gettime (2), |
| 54 |
.BR clock_nanosleep (2), |
| 55 |
.BR nanosleep (2), |
| 56 |
.BR timerfd_gettime (2), |
| 57 |
.BR timer_gettime (2), |
| 58 |
.BR time_t (3type), |
| 59 |
.BR timeval (3type) |