tail head cat sleep
QR code linking to this page

Manual Pages  — TIMESPEC_GET

NAME

timespec_get – get current calendar time

CONTENTS

LIBRARY

Standard C Library (libc, -lc)

SYNOPSIS

#include <time.h>

int
timespec_get(struct timespec *ts, int base);

DESCRIPTION

The timespec_get function sets the interval pointed to by ts to hold the current calendar time based on the specified time base in base.

The base TIME_UTC returns the time since the epoch. This time is expressed in seconds and nanoseconds since midnight (0 hour), January 1, 1970. In FreeBSD , this corresponds to CLOCK_REALTIME.

The base TIME_MONOTONIC returns a monotonically-increasing time since an unspecified point in the past. In FreeBSD , this corresponds to CLOCK_MONOTONIC.

RETURN VALUES

The timespec_get function returns the passed value of base if successful, otherwise 0 on failure.

SEE ALSO

clock_gettime(2), gettimeofday(2), time(3), timespec_getres(3)

STANDARDS

The timespec_get function with a base of TIME_UTC conforms to ISO/IEC .

HISTORY

This interface first appeared in FreeBSD 12 .

AUTHORS

Kamil Rytarowski <Mt kamil@NetBSD.org> Warner Losh <Mt imp@FreeBSD.org>

TIMESPEC_GET (3) August 21, 2023

tail head cat sleep
QR code linking to this page


Please direct any comments about this manual page service to Ben Bullock. Privacy policy.

Our grievance is not just against Unix itself, but against the cult of Unix zealots who defend and nurture it. They take the heat, disease, and pestilence as givens, and, as ancient shamans did, display their wounds, some self-inflicted, as proof of their power and wizardry. We aim, through bluntness and humor, to show them that they pray to a tin god, and that science, not religion, is the path to useful and friendly technology.
— The Unix Haters' handbook