1.\" 2.\" This file and its contents are supplied under the terms of the 3.\" Common Development and Distribution License ("CDDL"), version 1.0. 4.\" You may only use this file in accordance with the terms of version 5.\" 1.0 of the CDDL. 6.\" 7.\" A full copy of the text of the CDDL should have accompanied this 8.\" source. A copy of the CDDL is also available via the Internet at 9.\" http://www.illumos.org/license/CDDL. 10.\" 11.\" 12.\" Copyright 2016 Joyent, Inc. 13.\" 14.Dd "Mar 25, 2016" 15.Dt TIMESPEC_GET 3C 16.Os 17.Sh NAME 18.Nm timespec_get 19.Nd get time information 20.Sh SYNOPSIS 21.In time.h 22.Ft int 23.Fo timespec_get 24.Fa "struct timespec *ts" 25.Fa "int base" 26.Fc 27.Sh DESCRIPTION 28The 29.Fn timespec_get 30function provides access nanosecond resolution time. 31The meaning and source of time is defined by the 32.Fa base 33argument. 34The following values are defined for 35.Fa base : 36.Bl -tag -width Ds 37.It Sy TIME_UTC 38Obtain the current time of day from the realtime clock on the system. 39It represents the amount of time in second and nanoseconds since the Epoch. 40This is logically equivalent to calling 41.Xr clock_gettime 3C 42with 43.Sy CLOCK_REALTIME . 44.El 45.Pp 46For the definition of the 47.Sy timespec 48structure, see 49.Xr time.h 3HEAD . 50.Sh RETURN VALUES 51Upon successful completion, the 52.Fn timespec_get 53function returns the passed in value of 54.Fa base . 55Otherwise, 56.Sy 0 57is returned to represent an error. 58.Sh ERRORS 59Unlike other functions, the 60.Fn timespec_get 61function is not defined to set 62.Sy errno . 63However, the 64.Fn timespec_get 65function will fail if: 66.Bl -bullet -offset indent 67.It 68The value of 69.Fa base 70does not refer to a known time specification. 71.It 72There was an error obtaining the time for 73.Fa base . 74.El 75.Sh INTERFACE STABILITY 76.Sy Standard 77.Sh MT-LEVEL 78.Sy MT-Safe 79.Sh SEE ALSO 80.Xr clock_gettime 3C , 81.Xr time.h 3HEAD , 82.Xr attributes 5 83