xref: /dflybsd-src/lib/libc/stdtime/timespec_get.3 (revision d4155bf40214a508c4a41d2a26d0b12e900bd828)
16219de94STomasz Konojacki.\"
26219de94STomasz Konojacki.\" Copyright (c) 2016 The DragonFly Project. All rights reserved.
36219de94STomasz Konojacki.\"
46219de94STomasz Konojacki.\" This code is derived from software contributed to The DragonFly Project
56219de94STomasz Konojacki.\" by Tomasz Konojacki <me@xenu.pl>.
66219de94STomasz Konojacki.\"
76219de94STomasz Konojacki.\" Redistribution and use in source and binary forms, with or without
86219de94STomasz Konojacki.\" modification, are permitted provided that the following conditions
96219de94STomasz Konojacki.\" are met:
106219de94STomasz Konojacki.\"
116219de94STomasz Konojacki.\" 1. Redistributions of source code must retain the above copyright
126219de94STomasz Konojacki.\"    notice, this list of conditions and the following disclaimer.
136219de94STomasz Konojacki.\" 2. Redistributions in binary form must reproduce the above copyright
146219de94STomasz Konojacki.\"    notice, this list of conditions and the following disclaimer in
156219de94STomasz Konojacki.\"    the documentation and/or other materials provided with the
166219de94STomasz Konojacki.\"    distribution.
176219de94STomasz Konojacki.\" 3. Neither the name of The DragonFly Project nor the names of its
186219de94STomasz Konojacki.\"    contributors may be used to endorse or promote products derived
196219de94STomasz Konojacki.\"    from this software without specific, prior written permission.
206219de94STomasz Konojacki.\"
216219de94STomasz Konojacki.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
226219de94STomasz Konojacki.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
236219de94STomasz Konojacki.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
246219de94STomasz Konojacki.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
256219de94STomasz Konojacki.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
266219de94STomasz Konojacki.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
276219de94STomasz Konojacki.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
286219de94STomasz Konojacki.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
296219de94STomasz Konojacki.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
306219de94STomasz Konojacki.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
316219de94STomasz Konojacki.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
326219de94STomasz Konojacki.\" SUCH DAMAGE.
336219de94STomasz Konojacki.\"
346219de94STomasz Konojacki.Dd January 30, 2016
356219de94STomasz Konojacki.Dt TIMESPEC_GET 3
366219de94STomasz Konojacki.Os
376219de94STomasz Konojacki.Sh NAME
386219de94STomasz Konojacki.Nm timespec_get
39*d4155bf4SSascha Wildner.Nd Set specified timespec structure to a current time
406219de94STomasz Konojacki.Sh LIBRARY
416219de94STomasz Konojacki.Lb libc
426219de94STomasz Konojacki.Sh SYNOPSIS
436219de94STomasz Konojacki.In time.h
446219de94STomasz Konojacki.Ft int
456219de94STomasz Konojacki.Fn timespec_get "struct timespec *ts" "int base"
466219de94STomasz Konojacki.Sh DESCRIPTION
476219de94STomasz KonojackiThe function
486219de94STomasz Konojacki.Fn timespec_get
496219de94STomasz Konojackitakes two arguments, a pointer to a
506219de94STomasz Konojacki.Vt timespec
516219de94STomasz Konojackistructure and desired time base.
526219de94STomasz KonojackiThe function sets structure pointed by the
536219de94STomasz Konojacki.Fa ts
546219de94STomasz Konojackiargument to hold current clock time, basing on time base specified in the
556219de94STomasz Konojacki.Fa base
566219de94STomasz Konojackiargument.
576219de94STomasz KonojackiCurrently only the
586219de94STomasz Konojacki.Dv TIME_UTC
596219de94STomasz Konojackibase is supported.
606219de94STomasz Konojacki.Sh RETURN VALUES
616219de94STomasz KonojackiUpon successful completion,
626219de94STomasz Konojacki.Fn timespec_get
636219de94STomasz Konojackiwill use its argument
646219de94STomasz Konojacki.Fa base
656219de94STomasz Konojackias a return value.
666219de94STomasz KonojackiOtherwise, a value of 0 is returned and
676219de94STomasz Konojacki.Va errno
686219de94STomasz Konojackiis set to indicate the error.
696219de94STomasz Konojacki.Sh ERRORS
706219de94STomasz Konojacki.Bl -tag -width Er
716219de94STomasz Konojacki.It Bq Er EINVAL
726219de94STomasz KonojackiThe
736219de94STomasz Konojacki.Fa base
746219de94STomasz Konojackiargument to
756219de94STomasz Konojacki.Fn timespec_get
766219de94STomasz Konojackiwas invalid.
776219de94STomasz Konojacki.El
786219de94STomasz Konojacki.Pp
796219de94STomasz KonojackiThe
806219de94STomasz Konojacki.Fn timespec_get
816219de94STomasz Konojackifunction may also fail and set
826219de94STomasz Konojacki.Va errno
836219de94STomasz Konojackifor any of the errors specified for
846219de94STomasz Konojacki.Xr clock_gettime 2 .
856219de94STomasz Konojacki.Sh SEE ALSO
866219de94STomasz Konojacki.Xr clock_gettime 2 ,
876219de94STomasz Konojacki.Xr time 3
886219de94STomasz Konojacki.Sh STANDARDS
896219de94STomasz KonojackiThe
906219de94STomasz Konojacki.Fn timespec_get
916219de94STomasz Konojackifunction conforms to
926219de94STomasz Konojacki.St -isoC-2011 .
93