1 .\" $NetBSD: clock_settime.2,v 1.20 2009/03/11 13:39:14 joerg 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.
108 If the calling user is not the super-user, then the
110 function in the standard C library will try to use the
112 device if present, thus making possible for non privileged users to
116 is not present or not accessible, then
120 system call, which is restricted to the super user.
122 A value of 0 is returned on success.
123 Otherwise, a value of \-1 is returned and
125 is set to indicate the error.
132 functions will fail if:
137 argument does not specify a known clock.
139 The function is not supported by this implementation.
144 function will fail if:
149 argument is outside the range for the specified clock,
154 argument specified a nanosecond value less than zero of greater than or equal
159 argument is a clock that can not be adjusted.
162 calling process does not have the appropriate privilege to set the specified
169 function will fail if:
174 argument specifies an address that is not a valid part of the process address
180 .\" .Xr timer_gettime 3 ,