Movatterモバイル変換


[0]ホーム

URL:


man7.org > Linux >man-pages

Linux/UNIX system programming training


timespec_get(3) — Linux manual page

NAME |LIBRARY |SYNOPSIS |DESCRIPTION |RETURN VALUE |ATTRIBUTES |STANDARDS |HISTORY |SEE ALSO |COLOPHON

timespec_get(3)          Library Functions Manualtimespec_get(3)

NAME        top

       timespec_get, timespec_getres - ISO C interface to clock and time       functions

LIBRARY        top

       Standard C library (libc,-lc),

SYNOPSIS        top

#include <time.h>int timespec_get(struct timespec *res, intbase);int timespec_getres(struct timespec *tp, intbase);

DESCRIPTION        top

       Thetimespec_get() function stores the current time, based on the       specified time base, in thetimespec(3type) structure pointed to       byres.       Thetimespec_getres() function stores the resolution of times       retrieved bytimespec_get() with the specified time base in thetimespec(3type) structure pointed to bytp, iftp is non-NULL.       For a particular time base, the resolution is constant for the       lifetime of the calling process.TIME_UTCis always a supported time base, and is the only time       base supported on Linux.  The time and resolution in this time       base are the same as those retrieved byclock_gettime(CLOCK_REALTIME, res) andclock_getres(CLOCK_REALTIME, tp), respectively.  Other systems may       support additional time bases.

RETURN VALUE        top

timespec_get() returns the nonzerobase if it is a supported time       base and the current time was successfully retrieved, or 0       otherwise.timespec_getres() returns the nonzerobase if it is a supported       time base, or 0 otherwise.

ATTRIBUTES        top

       For an explanation of the terms used in this section, seeattributes(7).       ┌──────────────────────────────────────┬───────────────┬─────────┐       │InterfaceAttributeValue│       ├──────────────────────────────────────┼───────────────┼─────────┤       │timespec_get(),timespec_getres()    │ Thread safety │ MT-Safe │       └──────────────────────────────────────┴───────────────┴─────────┘

STANDARDS        top

timespec_get()TIME_UTC              C23 (though ISO C doesn't specify the time epoch),              POSIX.1-2024.timespec_getres()              C23.

HISTORY        top

timespec_get()TIME_UTC              C11, POSIX.1-2024, glibc 2.16, musl 1.1.10.timespec_getres()              C23, glibc 2.34.

SEE ALSO        top

clock_gettime(2),clock_getres(2)

COLOPHON        top

       This page is part of theman-pages (Linux kernel and C library       user-space interface documentation) project.  Information about       the project can be found at        ⟨https://www.kernel.org/doc/man-pages/⟩.  If you have a bug report       for this manual page, see       ⟨https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING⟩.       This page was obtained from the tarball man-pages-6.16.tar.gz       fetched from       ⟨https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/⟩ on       2026-01-16.  If you discover any rendering problems in this HTML       version of the page, or you believe there is a better or more up-       to-date source for the page, or you have corrections or       improvements to the information in this COLOPHON (which isnot       part of the original manual page), send a mail to       man-pages@man7.orgLinux man-pages 6.16            2025-02-10timespec_get(3)


HTML rendering created 2026-01-16 byMichael Kerrisk, author ofThe Linux Programming Interface.

For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere.

Hosting byjambit GmbH.

Cover of TLPI


[8]ページ先頭

©2009-2026 Movatter.jp