xref: /dflybsd-src/lib/libc/stdtime/timespec_get.3 (revision 6219de94fd7e22a59851e8b8ac2f00a758e14835)
1*6219de94STomasz Konojacki.\"
2*6219de94STomasz Konojacki.\" Copyright (c) 2016 The DragonFly Project. All rights reserved.
3*6219de94STomasz Konojacki.\"
4*6219de94STomasz Konojacki.\" This code is derived from software contributed to The DragonFly Project
5*6219de94STomasz Konojacki.\" by Tomasz Konojacki <me@xenu.pl>.
6*6219de94STomasz Konojacki.\"
7*6219de94STomasz Konojacki.\" Redistribution and use in source and binary forms, with or without
8*6219de94STomasz Konojacki.\" modification, are permitted provided that the following conditions
9*6219de94STomasz Konojacki.\" are met:
10*6219de94STomasz Konojacki.\"
11*6219de94STomasz Konojacki.\" 1. Redistributions of source code must retain the above copyright
12*6219de94STomasz Konojacki.\"    notice, this list of conditions and the following disclaimer.
13*6219de94STomasz Konojacki.\" 2. Redistributions in binary form must reproduce the above copyright
14*6219de94STomasz Konojacki.\"    notice, this list of conditions and the following disclaimer in
15*6219de94STomasz Konojacki.\"    the documentation and/or other materials provided with the
16*6219de94STomasz Konojacki.\"    distribution.
17*6219de94STomasz Konojacki.\" 3. Neither the name of The DragonFly Project nor the names of its
18*6219de94STomasz Konojacki.\"    contributors may be used to endorse or promote products derived
19*6219de94STomasz Konojacki.\"    from this software without specific, prior written permission.
20*6219de94STomasz Konojacki.\"
21*6219de94STomasz Konojacki.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22*6219de94STomasz Konojacki.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23*6219de94STomasz Konojacki.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24*6219de94STomasz Konojacki.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
25*6219de94STomasz Konojacki.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26*6219de94STomasz Konojacki.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27*6219de94STomasz Konojacki.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28*6219de94STomasz Konojacki.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29*6219de94STomasz Konojacki.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30*6219de94STomasz Konojacki.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31*6219de94STomasz Konojacki.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32*6219de94STomasz Konojacki.\" SUCH DAMAGE.
33*6219de94STomasz Konojacki.\"
34*6219de94STomasz Konojacki.Dd January 30, 2016
35*6219de94STomasz Konojacki.Dt TIMESPEC_GET 3
36*6219de94STomasz Konojacki.Os
37*6219de94STomasz Konojacki.Sh NAME
38*6219de94STomasz Konojacki.Nm timespec_get
39*6219de94STomasz Konojacki.Nd Set specified timespec structure to a current time.
40*6219de94STomasz Konojacki.Sh LIBRARY
41*6219de94STomasz Konojacki.Lb libc
42*6219de94STomasz Konojacki.Sh SYNOPSIS
43*6219de94STomasz Konojacki.In time.h
44*6219de94STomasz Konojacki.Ft int
45*6219de94STomasz Konojacki.Fn timespec_get "struct timespec *ts" "int base"
46*6219de94STomasz Konojacki.Sh DESCRIPTION
47*6219de94STomasz KonojackiThe function
48*6219de94STomasz Konojacki.Fn timespec_get
49*6219de94STomasz Konojackitakes two arguments, a pointer to a
50*6219de94STomasz Konojacki.Vt timespec
51*6219de94STomasz Konojackistructure and desired time base.
52*6219de94STomasz KonojackiThe function sets structure pointed by the
53*6219de94STomasz Konojacki.Fa ts
54*6219de94STomasz Konojackiargument to hold current clock time, basing on time base specified in the
55*6219de94STomasz Konojacki.Fa base
56*6219de94STomasz Konojackiargument.
57*6219de94STomasz KonojackiCurrently only the
58*6219de94STomasz Konojacki.Dv TIME_UTC
59*6219de94STomasz Konojackibase is supported.
60*6219de94STomasz Konojacki.Sh RETURN VALUES
61*6219de94STomasz KonojackiUpon successful completion,
62*6219de94STomasz Konojacki.Fn timespec_get
63*6219de94STomasz Konojackiwill use its argument
64*6219de94STomasz Konojacki.Fa base
65*6219de94STomasz Konojackias a return value.
66*6219de94STomasz KonojackiOtherwise, a value of 0 is returned and
67*6219de94STomasz Konojacki.Va errno
68*6219de94STomasz Konojackiis set to indicate the error.
69*6219de94STomasz Konojacki.Sh ERRORS
70*6219de94STomasz Konojacki.Bl -tag -width Er
71*6219de94STomasz Konojacki.It Bq Er EINVAL
72*6219de94STomasz KonojackiThe
73*6219de94STomasz Konojacki.Fa base
74*6219de94STomasz Konojackiargument to
75*6219de94STomasz Konojacki.Fn timespec_get
76*6219de94STomasz Konojackiwas invalid.
77*6219de94STomasz Konojacki.El
78*6219de94STomasz Konojacki.Pp
79*6219de94STomasz KonojackiThe
80*6219de94STomasz Konojacki.Fn timespec_get
81*6219de94STomasz Konojackifunction may also fail and set
82*6219de94STomasz Konojacki.Va errno
83*6219de94STomasz Konojackifor any of the errors specified for
84*6219de94STomasz Konojacki.Xr clock_gettime 2 .
85*6219de94STomasz Konojacki.Sh SEE ALSO
86*6219de94STomasz Konojacki.Xr clock_gettime 2 ,
87*6219de94STomasz Konojacki.Xr time 3
88*6219de94STomasz Konojacki.Sh STANDARDS
89*6219de94STomasz KonojackiThe
90*6219de94STomasz Konojacki.Fn timespec_get
91*6219de94STomasz Konojackifunction conforms to
92*6219de94STomasz Konojacki.St -isoC-2011 .
93