1 .\" $NetBSD: clock_settime.2,v 1.22 2014/03/28 15:35:55 wiz Exp $
3 .\" Copyright (c) 1999 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
37 .Nd clock and timer functions
43 .Fn clock_settime "clockid_t clock_id" "const struct timespec *tp"
45 .Fn clock_gettime "clockid_t clock_id" "struct timespec *tp"
47 .Fn clock_getres "clockid_t clock_id" "struct timespec *res"
51 function sets the clock identified by
53 to the absolute time specified by
55 If the time specified by
57 is not a multiple of the resolution of the clock,
59 is truncated to a multiple of the resolution.
63 function stores the time of the clock identified by
65 into the location specified by
70 function stores the resolution of the clock identified by
72 into the location specified by
83 identifies the realtime clock for the system.
84 For this clock, the values specified by
88 represent the amount of time (in seconds and nanoseconds)
89 since 00:00 Universal Coordinated Time, January 1, 1970.
95 identifies a clock that increases at a steady rate (monotonically).
97 is not affected by calls to
104 error if it's the clock specified in a call to
106 The origin of the clock is unspecified.
112 identifies a clock that increments only when the CPU is running in
113 user mode on behalf of the calling process.
119 identifies a clock that increments when the CPU is running in user
120 or kernel mode on behalf of the calling process.
122 If the calling user is not the super-user, then the
124 function in the standard C library will try to use the
126 device if present, thus making possible for non privileged users to
130 is not present or not accessible, then
134 system call, which is restricted to the super user.
136 A value of 0 is returned on success.
137 Otherwise, a value of \-1 is returned and
139 is set to indicate the error.
146 functions will fail if:
151 argument does not specify a known clock.
153 The function is not supported by this implementation.
158 function will fail if:
163 argument is outside the range for the specified clock,
167 argument specified a nanosecond value less than zero of greater than or equal
171 argument is a clock that can not be adjusted.
174 calling process does not have the appropriate privilege to set the specified
181 function will fail if:
186 argument specifies an address that is not a valid part of the process address
192 .\" .Xr timer_gettime 3 ,