7139 Sync mDNS with mDNSResponder-625.41.2
[unleashed.git] / usr / src / man / man3c / timespec_get.3c
blob7ae55f7b555bada5595387b1cf317f2c475d0d45
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
28 The
29 .Fn timespec_get
30 function provides access nanosecond resolution time. The
31 meaning and source of time is defined by the
32 .Fa base
33 argument. The following values are defined for
34 .Fa base :
35 .Bl -tag -width Ds
36 .It Sy TIME_UTC
37 Obtain the current time of day from the realtime clock on the system. It
38 represents the amount of time in second and nanoseconds since the Epoch.
39 This is logically equivalent to calling
40 .Xr clock_gettime 3C
41 with
42 .Sy CLOCK_REALTIME .
43 .El
44 .Pp
45 For the definition of the
46 .Sy timespec
47 structure, see
48 .Xr time.h 3HEAD .
49 .Sh RETURN VALUES
50 Upon successful completion, the
51 .Fn timespec_get
52 function returns the passed in value of
53 .Fa base .
54 Otherwise,
55 .Sy 0
56 is returned to represent an error.
57 .Sh ERRORS
58 Unlike other functions, the
59 .Fn timespec_get
60 function is not defined to set
61 .Sy errno .
62 However, the
63 .Fn timespec_get
64 function will fail if:
65 .Bl -bullet -offset indent
66 .It
67 The value of
68 .Fa base
69 does not refer to a known time specification.
70 .It
71 There 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