OSDN Git Service

(split) LDP_man-pages: release ioctl.2 [JM:00378]
[linuxjm/LDP_man-pages.git] / draft / man3 / adjtime.3
1 .\" Copyright (c) 2006 by Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" Japanese Version Copyright (c) 2006 Akihiro MOTOKI all rights reserved.
24 .\" Translated 2006-07-16, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
25 .\"
26 .TH ADJTIME 3 2008-06-22 "Linux" "Linux Programmer's Manual"
27 .\"O .SH NAME
28 .SH Ì¾Á°
29 .\"O adjtime \- correct the time to synchronize the system clock
30 adjtime \- ¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤ËƱ´ü¤¹¤ë»þ¹ï¤òÄ´À°¤¹¤ë
31 .\"O .SH SYNOPSIS
32 .SH ½ñ¼°
33 .nf
34 .BI "int adjtime(const struct timeval *" delta ", struct timeval *" olddelta );
35 .fi
36 .sp
37 .in -4n
38 .\"O Feature Test Macro Requirements for glibc (see
39 .\"O .BR feature_test_macros (7)):
40 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
41 .RB ( feature_test_macros (7)
42 »²¾È):
43 .in
44 .sp
45 .BR adjtime ():
46 _BSD_SOURCE
47 .\"O .SH DESCRIPTION
48 .SH ÀâÌÀ
49 .\"O The
50 .\"O .BR adjtime ()
51 .\"O function gradually adjusts the system clock (as returned by
52 .\"O .BR gettimeofday (2)).
53 .\"O The amount of time by which the clock is to be adjusted is specified
54 .\"O in the structure pointed to by
55 .\"O .IR delta .
56 .\"O This structure has the following form:
57 .BR adjtime ()
58 ´Ø¿ô¤Ï
59 .RB ( gettimeofday (2)
60 ¤¬ÊÖ¤¹) ¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤ò½ù¡¹¤ËÄ´À°¤¹¤ë¡£
61 Ä´À°¤¹¤Ù¤­¥¯¥í¥Ã¥¯¤Î»þ´ÖÎ̤Ï
62 .I delta
63 ¤¬»Ø¤¹¹½Â¤ÂΤǻØÄꤵ¤ì¤ë¡£
64 ¤³¤Î¹½Â¤ÂΤϰʲ¼¤Î·Á¤Ç¤¢¤ë:
65 .in +4n
66 .nf
67
68 struct timeval {
69 .\"O     time_t      tv_sec;     /* seconds */
70 .\"O     suseconds_t tv_usec;    /* microseconds */
71     time_t      tv_sec;     /* Éà*/
72     suseconds_t tv_usec;    /* ¥Þ¥¤¥¯¥íÉà*/
73 };
74 .fi
75 .in
76 .PP
77 .\"O If the adjustment in
78 .\"O .I delta
79 .\"O is positive, then the system clock is speeded up by some
80 .\"O small percentage (i.e., by adding a small
81 .\"O amount of time to the clock value in each second) until the adjustment
82 .\"O has been completed.
83 .\"O If the adjustment in
84 .\"O .I delta
85 .\"O is negative, then the clock is slowed down in a similar fashion.
86 .I delta
87 ¤ÎÄ´À°Î̤¬Àµ¤Î¾ì¹ç¡¢Ä´À°Î̤Ë㤹¤ë¤Þ¤Ç¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤ò
88 ¾¯¤·³ä¹ç¤À¤±¥¹¥Ô¡¼¥É¥¢¥Ã¥×¤µ¤»¤ë (¤Ä¤Þ¤ê¡¢ËèÉÃ¥¯¥í¥Ã¥¯Ãͤ˾¯¤·¤À¤±
89 »þ¹ï¤ò²Ã»»¤¹¤ë)¡£
90 .I delta
91 ¤ÎÄ´À°Î̤¬Éé¤Î¾ì¹ç¡¢Æ±ÍͤÎÊýË¡¤Ç¥¯¥í¥Ã¥¯¤òÃÙ¤¯¤¹¤ë¡£
92
93 .\"O If a clock adjustment from an earlier
94 .\"O .BR adjtime ()
95 .\"O call is already in progress
96 .\"O at the time of a later
97 .\"O .BR adjtime ()
98 .\"O call, and
99 .\"O .I delta
100 .\"O is not NULL for the later call, then the earlier adjustment is stopped,
101 .\"O but any already completed part of that adjustment is not undone.
102 .BR adjtime ()
103 ¤¬¸Æ¤Ó½Ð¤µ¤ì¤¿¤È¤­¤Ë°ÊÁ°¤Î
104 .BR adjtime ()
105 ¤Î¸Æ¤Ó½Ð¤·¤Ë¤è¤ë¥¯¥í¥Ã¥¯¤ÎÄ´À°¤¬¤Þ¤À¼Â¹ÔÃæ¤Ç¡¢¤«¤Ä¸å¤Î
106 .BR adjtime ()
107 ¤Î
108 .I delta
109 ¤¬ NULL ¤Ç¤Ê¤¤¾ì¹ç¡¢¼Â¹ÔÃæ¤ÎÄ´À°¤ÏÄä»ß¤µ¤ì¤ë¡£
110 ¤·¤«¤·¡¢¤¹¤Ç¤Ë¼Â¹Ô¤µ¤ì¤¿Ä´À°¤Î¼è¤ê¾Ã¤·¤Ï¹Ô¤ï¤ì¤Ê¤¤¡£
111
112 .\"O If
113 .\"O .I olddelta
114 .\"O is not NULL, then the buffer that it points to is used to return
115 .\"O the amount of time remaining from any previous adjustment that
116 .\"O has not yet been completed.
117 .I olddelta
118 ¤¬ NULL ¤Ç¤Ê¤¤¾ì¹ç¡¢
119 .I olddelta
120 ¤¬»Ø¤¹¥Ð¥Ã¥Õ¥¡¤Ë¡¢²áµî¤ÎÄ´À°Í×µá¤Ç¤Þ¤À´°Î»¤»¤º»Ä¤Ã¤Æ¤¤¤ë»þ´ÖÎ̤¬
121 ³ÊǼ¤·¤ÆÊÖ¤µ¤ì¤ë¡£
122 .\"O .SH "RETURN VALUE"
123 .SH ÊÖ¤êÃÍ
124 .\"O On success,
125 .\"O .BR adjtime ()
126 .\"O returns 0.  On failure, \-1 is returned, and
127 .\"O .I errno
128 .\"O is set to indicate the error.
129 À®¸ù¤¹¤ë¤È¡¢
130 .BR adjtime ()
131 ¤Ï 0 ¤òÊÖ¤¹¡£¼ºÇÔ¤¹¤ë¤È¡¢\-1 ¤òÊÖ¤·¡¢
132 .I errno
133 ¤Ë¥¨¥é¡¼¤ò¼¨¤¹Ãͤò¥»¥Ã¥È¤¹¤ë¡£
134 .\"O .SH ERRORS
135 .SH ¥¨¥é¡¼
136 .TP
137 .B EINVAL
138 .\"O The adjustment in
139 .\"O .I delta
140 .\"O is outside the permitted range.
141 .I delta
142 ¤Ç»ØÄꤵ¤ì¤¿Ä´À°Î̤¬µö²Ä¤µ¤ì¤¿ÈϰϤËÆþ¤Ã¤Æ¤¤¤Ê¤¤¡£
143 .TP
144 .B EPERM
145 .\"O The caller does not have sufficient privilege to adjust the time.
146 .\"O Under Linux the
147 .\"O .B CAP_SYS_TIME
148 .\"O capability is required.
149 ¸Æ¤Ó½Ð¤·¼Ô¤¬»þ¹ï¤òÄ´À°¤¹¤ë¤Î¤ËɬÍפʸ¢¸Â¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£
150 Linux ¤Ç¤Ï
151 .B CAP_SYS_TIME
152 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤¬É¬ÍפǤ¢¤ë¡£
153 .\"O .SH CONFORMING TO
154 .SH ½àµò
155 4.3BSD, System V.
156 .\"O .SH NOTES
157 .SH Ãí°Õ
158 .\"O The adjustment that
159 .\"O .BR adjtime ()
160 .\"O makes to the clock is carried out in such a manner that the clock
161 .\"O is always monotonically increasing.
162 .\"O Using
163 .\"O .BR adjtime ()
164 .\"O to adjust the time prevents the problems that can be caused for certain
165 .\"O applications (e.g.,
166 .\"O .BR make (1))
167 .\"O by abrupt positive or negative jumps in the system time.
168 .BR adjtime ()
169 ¤¬¹Ô¤¦¥¯¥í¥Ã¥¯¤ÎÄ´À°¤Ï¡¢¥¯¥í¥Ã¥¯¤Ï¾ï¤ËñĴÁý²Ã¤¹¤ë¤È¤¤¤¦ÈÏ°ÏÆâ¤Ç
170 ¼Â¹Ô¤µ¤ì¤ë¡£
171 .BR adjtime ()
172 ¤ò»È¤Ã¤Æ»þ¹ï¤òÄ´À°¤¹¤ë¤³¤È¤Ç¡¢¥·¥¹¥Æ¥à¥¿¥¤¥à¤ÎÆÍÁ³¤ÎÀµ¤äÉé¤Î¥¸¥ã¥ó¥×
173 ¤Ë¤è¤ê¡¢¤¤¤¯¤Ä¤«¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó (Î㤨¤Ð
174 .BR make (1)
175 ¤Ê¤É) ¤Ëµ¯¤³¤ëÌäÂê¤òËɤ°¤³¤È¤¬¤Ç¤­¤ë¡£
176
177 .\"O .BR adjtime ()
178 .\"O is intended to be used to make small adjustments to the system time.
179 .\"O Most systems impose a limit on the adjustment that can be specified in
180 .\"O .IR delta .
181 .\"O In the glibc implementation,
182 .\"O .I delta
183 .\"O must be less than or equal to (INT_MAX / 1000000 \- 2)
184 .\"O and greater than or equal to (INT_MIN / 1000000 + 2)
185 .\"O (respectively 2145 and \-2145 seconds on i386).
186 .BR adjtime ()
187 ¤Ï¥·¥¹¥Æ¥à»þ¹ï¤Ë¾¯¤·¤º¤ÄÄ´À°¤ò¹Ô¤¦¤¿¤á¤Ë»ÈÍѤµ¤ì¤ë¤³¤È¤ò´üÂÔ¤µ¤ì¤Æ¤¤¤ë¡£
188 ¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤Ç¤Ï¡¢
189 .I delta
190 ¤Ë»ØÄê¤Ç¤­¤ëÄ´À°Î̤ËÀ©¸Â¤ò²Ý¤·¤Æ¤¤¤ë¡£
191 glibc ¤Î¼ÂÁõ¤Ç¤Ï¡¢
192 .I delta
193 ¤Ï (INT_MIN / 1000000 + 2) °Ê¾å (INT_MAX / 1000000 \- 2) °Ê²¼
194 (i386 ¤Ç¤Ï \-2145 °Ê¾å 2145 °Ê²¼) ¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
195 .\"O .SH BUGS
196 .SH ¥Ð¥°
197 .\"O A longstanding bug
198 .\"O .\" http://sourceware.org/bugzilla/show_bug?id=2449
199 .\"O .\" http://bugzilla.kernel.org/show_bug.cgi?id=6761
200 .\"O meant that if
201 .\"O .I delta
202 .\"O was specified as NULL,
203 .\"O no valid information about the outstanding clock adjustment was returned in
204 .\"O .IR olddelta .
205 .\"O (In this circumstance,
206 .\"O .BR adjtime ()
207 .\"O should return the outstanding clock adjustment, without changing it.)
208 .\"O This bug is fixed
209 .\"O .\" Thanks to the new adjtimex() ADJ_OFFSET_SS_READ flag
210 .\"O on systems with glibc 2.8 or later and
211 .\"O Linux kernel 2.6.26 or later.
212 ¤º¤Ã¤ÈÀΤ«¤é¡¢
213 .\" http://sourceware.org/bugzilla/show_bug?id=2449
214 .\" http://bugzilla.kernel.org/show_bug.cgi?id=6761
215 .I delta
216 ¤Ë NULL ¤ò»ØÄꤹ¤ë¤È¡¢Ì¤´°Î»¤Î¥¯¥í¥Ã¥¯Ä´À°¤Ë´Ø¤¹¤ëÍ­¸ú¤Ê¾ðÊó¤¬
217 .I olddelta
218 ¤ËÊÖ¤µ¤ì¤Ê¤¤¤È¤¤¤¦¥Ð¥°¤¬¤¢¤Ã¤¿ (¤³¤Î¾ì¹ç¡¢
219 .BR adjtime ()
220 ¤Ï¡¢Ì¤´°Î»¤Î¥¯¥í¥Ã¥¯Ä´À°¤Ë´Ø¤¹¤ë¾ðÊó¤ò¡¢Êѹ¹¤»¤º¤ËÊÖ¤¹¤Ù¤­¤Ç¤¢¤ë)¡£
221 ¤³¤Î¥Ð¥°¤Ï¡¢
222 .\" adjtimex() ¤Î¿·¤·¤¤¥Õ¥é¥° ADJ_OFFSET_SS_READ ¤Î¤ª¤«¤²¤À¡£
223 glibc 2.8 °Ê¹ß¤Ç¡¢Linux ¥«¡¼¥Í¥ë 2.6.26 °Ê¹ß¤Î¥·¥¹¥Æ¥à¤Ç½¤Àµ¤µ¤ì¤Æ¤¤¤ë¡£
224 .\"O .SH "SEE ALSO"
225 .SH ´ØÏ¢¹àÌÜ
226 .BR adjtimex (2),
227 .BR gettimeofday (2),
228 .BR time (7)