timespec_get3
Get current calendar time
Usage
#include <time.h>
int
timespec_get(struct timespec *ts, int base);
Library
Standard C Library (libc, -lc)
Overview
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.
Releases
20 releases since FreeBSD 12.0-RELEASE; the text changed 8 times.