xref: /titanic_44/usr/src/man/man3c/timespec_get.3c (revision e01ec5d5f4fc831c481861bbc5813ed87c953ac4)
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. The
31meaning and source of time is defined by the
32.Fa base
33argument. The following values are defined for
34.Fa base :
35.Bl -tag -width Ds
36.It Sy TIME_UTC
37Obtain the current time of day from the realtime clock on the system. It
38represents the amount of time in second and nanoseconds since the Epoch.
39This is logically equivalent to calling
40.Xr clock_gettime 3C
41with
42.Sy CLOCK_REALTIME .
43.El
44.Pp
45For the definition of the
46.Sy timespec
47structure, see
48.Xr time.h 3HEAD .
49.Sh RETURN VALUES
50Upon successful completion, the
51.Fn timespec_get
52function returns the passed in value of
53.Fa base .
54Otherwise,
55.Sy 0
56is returned to represent an error.
57.Sh ERRORS
58Unlike other functions, the
59.Fn timespec_get
60function is not defined to set
61.Sy errno .
62However, the
63.Fn timespec_get
64function will fail if:
65.Bl -bullet -offset indent
66.It
67The value of
68.Fa base
69does not refer to a known time specification.
70.It
71There was an error obtaining the time for
72.Fa base .
73.El
74.Sh INTERFACE STABILITY
75.Sy Standard
76.Sh MT-LEVEL
77.Sy MT-Safe
78.Sh SEE ALSO
79.Xr clock_gettime 3C ,
80.Xr time.h 3HEAD ,
81.Xr attributes 5
82