TIMESPEC_GET(3)

TIMESPEC_GET(3) | Library Functions Manual | TIMESPEC_GET(3)

# NAME

timespec_get — get current calendar time

# LIBRARY

Standard C Library (libc, -lc)

# SYNOPSIS

#include <time.h>
#define TIME_UTC 1
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.
Currently the only supported valid base is `TIME_UTC`. It returns time elapsed since epoch.

# RETURN VALUES

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

# SEE ALSO

clock_gettime(2)

# STANDARDS

The timespec_get function conforms to ISO/IEC 9899:2011 (“ISO C11”).

# HISTORY

This interface first appeared in NetBSD 8.

# AUTHORS

Kamil Rytarowski <kamil@NetBSD.org>

October 4, 2016 | NetBSD 8.0