If you're wondering how errno is affected, so am I; no-one really says; quoth POSIX: If base is TIME_UTC, the members of ts shall be set to the same values as would be set by a call to clock_gettime(CLOCK_REALTIME, ts). RETURN VALUE If the timespec_get( ) function is successful it shall return the non-zero value base; otherwise, it shall return zero. ERRORS See DESCRIPTION. But this is a moot point since clock_gettime() can't fail anyway (glibc doesn't even check the error). Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@xxxxxxxxxxxxxxxxxx> --- man/man3/timespec_get.3 | 82 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 man/man3/timespec_get.3 diff --git a/man/man3/timespec_get.3 b/man/man3/timespec_get.3 new file mode 100644 index 000000000..5e053d551 --- /dev/null +++ b/man/man3/timespec_get.3 @@ -0,0 +1,82 @@ +'\" t +.\" SPDX-License-Identifier: 0BSD +.\" +.TH timespec_get 3 (date) "Linux man-pages (unreleased)" +.SH NAME +timespec_get, timespec_getres \- standard C clock and time functions +.SH LIBRARY +Standard C library +.RI ( libc ,\~ \-lc ), +.SH SYNOPSIS +.nf +.B #include <time.h> +.P +.BI "int timespec_get(struct timespec *" res ", int " base ); +.BI "int timespec_getres(struct timespec *" tp ", int " base ); +.fi +.P +.RS -4 +Feature Test Macro Requirements for glibc (see +.BR feature_test_macros (7)): +.RE +.P +.BR timespec_get (): +.nf + _ISOC11_SOURCE || _ISOC2X_SOURCE + || __STDC_VERSION__ >= 201112L + || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE +.P +.BR timespec_getres (): +.nf + _ISOC2X_SOURCE || __STDC_VERSION__ > 201710L +.fi +.SH DESCRIPTION +.BI timespec_get\fR(\fP tp ", TIME_UTC)" +is defined as +.BI "clock_gettime\fR(\fPCLOCK_REALTIME, " tp )\fR.\fP +.P +.BI timespec_getres\fR(\fP res ", TIME_UTC)" +is equivalent to +.BI "timespec_getres\fR(\fPCLOCK_REALTIME, " res )\fR.\fP +.P +.BR TIME_UTC +is universally guaranteed to be a valid +.IR base , +and is the only one supported under Linux. +.SH RETURN VALUE +.B 0 +if base is unsupported or the call failed, otherwise +.IR base . +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lbx lb lb +l l l. +Interface Attribute Value +T{ +.na +.nh +.BR timespec_get (), +.BR timespec_getres () +T} Thread safety MT-Safe +.TE +.SH STANDARDS +.BR timespec_get (), +.BR TIME_UTC : +C23, POSIX.1-2024. +.br +.BR timespec_getres (): +C23. +.br +.SH HISTORY +.BR timespec_get (), +.BR TIME_UTC : +C11, POSIX.1-2024, glibc 2.16, musl 1.1.10. +.br +.BR timespec_getres (): +C23, glibc 2.34. +.SH SEE ALSO +.BR clock_gettime (2), +.BR clock_getres (2) -- 2.39.2
Attachment:
signature.asc
Description: PGP signature