1 .\" Copyright (c) 2006 by Michael Kerrisk <mtk.manpages@gmail.com>
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.
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.
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
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" Japanese Version Copyright (c) 2006 Akihiro MOTOKI all rights reserved.
24 .\" Translated 2006-07-16, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
26 .TH ADJTIME 3 2008-06-22 "Linux" "Linux Programmer's Manual"
29 .\"O adjtime \- correct the time to synchronize the system clock
30 adjtime \- ¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤ËƱ´ü¤¹¤ë»þ¹ï¤òÄ´À°¤¹¤ë
34 .BI "int adjtime(const struct timeval *" delta ", struct timeval *" olddelta );
38 .\"O Feature Test Macro Requirements for glibc (see
39 .\"O .BR feature_test_macros (7)):
40 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
41 .RB ( feature_test_macros (7)
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
56 .\"O This structure has the following form:
59 .RB ( gettimeofday (2)
60 ¤¬ÊÖ¤¹) ¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤ò½ù¡¹¤ËÄ´À°¤¹¤ë¡£
61 Ä´À°¤¹¤Ù¤¥¯¥í¥Ã¥¯¤Î»þ´ÖÎ̤Ï
63 ¤¬»Ø¤¹¹½Â¤ÂΤǻØÄꤵ¤ì¤ë¡£
64 ¤³¤Î¹½Â¤ÂΤϰʲ¼¤Î·Á¤Ç¤¢¤ë:
69 .\"O time_t tv_sec; /* seconds */
70 .\"O suseconds_t tv_usec; /* microseconds */
71 time_t tv_sec; /* ÉÃ */
72 suseconds_t tv_usec; /* ¥Þ¥¤¥¯¥íÉà */
77 .\"O If the adjustment in
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
85 .\"O is negative, then the clock is slowed down in a similar fashion.
87 ¤ÎÄ´À°Î̤¬Àµ¤Î¾ì¹ç¡¢Ä´À°Î̤Ë㤹¤ë¤Þ¤Ç¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤ò
88 ¾¯¤·³ä¹ç¤À¤±¥¹¥Ô¡¼¥É¥¢¥Ã¥×¤µ¤»¤ë (¤Ä¤Þ¤ê¡¢ËèÉÃ¥¯¥í¥Ã¥¯Ãͤ˾¯¤·¤À¤±
91 ¤ÎÄ´À°Î̤¬Éé¤Î¾ì¹ç¡¢Æ±ÍͤÎÊýË¡¤Ç¥¯¥í¥Ã¥¯¤òÃÙ¤¯¤¹¤ë¡£
93 .\"O If a clock adjustment from an earlier
95 .\"O call is already in progress
96 .\"O at the time of a later
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.
103 ¤¬¸Æ¤Ó½Ð¤µ¤ì¤¿¤È¤¤Ë°ÊÁ°¤Î
105 ¤Î¸Æ¤Ó½Ð¤·¤Ë¤è¤ë¥¯¥í¥Ã¥¯¤ÎÄ´À°¤¬¤Þ¤À¼Â¹ÔÃæ¤Ç¡¢¤«¤Ä¸å¤Î
109 ¤¬ NULL ¤Ç¤Ê¤¤¾ì¹ç¡¢¼Â¹ÔÃæ¤ÎÄ´À°¤ÏÄä»ß¤µ¤ì¤ë¡£
110 ¤·¤«¤·¡¢¤¹¤Ç¤Ë¼Â¹Ô¤µ¤ì¤¿Ä´À°¤Î¼è¤ê¾Ã¤·¤Ï¹Ô¤ï¤ì¤Ê¤¤¡£
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.
120 ¤¬»Ø¤¹¥Ð¥Ã¥Õ¥¡¤Ë¡¢²áµî¤ÎÄ´À°Í×µá¤Ç¤Þ¤À´°Î»¤»¤º»Ä¤Ã¤Æ¤¤¤ë»þ´ÖÎ̤¬
122 .\"O .SH "RETURN VALUE"
126 .\"O returns 0. On failure, \-1 is returned, and
128 .\"O is set to indicate the error.
131 ¤Ï 0 ¤òÊÖ¤¹¡£¼ºÇÔ¤¹¤ë¤È¡¢\-1 ¤òÊÖ¤·¡¢
133 ¤Ë¥¨¥é¡¼¤ò¼¨¤¹Ãͤò¥»¥Ã¥È¤¹¤ë¡£
138 .\"O The adjustment in
140 .\"O is outside the permitted range.
142 ¤Ç»ØÄꤵ¤ì¤¿Ä´À°Î̤¬µö²Ä¤µ¤ì¤¿ÈϰϤËÆþ¤Ã¤Æ¤¤¤Ê¤¤¡£
145 .\"O The caller does not have sufficient privilege to adjust the time.
148 .\"O capability is required.
149 ¸Æ¤Ó½Ð¤·¼Ô¤¬»þ¹ï¤òÄ´À°¤¹¤ë¤Î¤ËɬÍפʸ¢¸Â¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£
152 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤¬É¬ÍפǤ¢¤ë¡£
153 .\"O .SH CONFORMING TO
158 .\"O The adjustment that
160 .\"O makes to the clock is carried out in such a manner that the clock
161 .\"O is always monotonically increasing.
164 .\"O to adjust the time prevents the problems that can be caused for certain
165 .\"O applications (e.g.,
167 .\"O by abrupt positive or negative jumps in the system time.
169 ¤¬¹Ô¤¦¥¯¥í¥Ã¥¯¤ÎÄ´À°¤Ï¡¢¥¯¥í¥Ã¥¯¤Ï¾ï¤ËñĴÁý²Ã¤¹¤ë¤È¤¤¤¦ÈÏ°ÏÆâ¤Ç
172 ¤ò»È¤Ã¤Æ»þ¹ï¤òÄ´À°¤¹¤ë¤³¤È¤Ç¡¢¥·¥¹¥Æ¥à¥¿¥¤¥à¤ÎÆÍÁ³¤ÎÀµ¤äÉé¤Î¥¸¥ã¥ó¥×
173 ¤Ë¤è¤ê¡¢¤¤¤¯¤Ä¤«¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó (Î㤨¤Ð
175 ¤Ê¤É) ¤Ëµ¯¤³¤ëÌäÂê¤òËɤ°¤³¤È¤¬¤Ç¤¤ë¡£
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
181 .\"O In the glibc implementation,
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).
187 ¤Ï¥·¥¹¥Æ¥à»þ¹ï¤Ë¾¯¤·¤º¤ÄÄ´À°¤ò¹Ô¤¦¤¿¤á¤Ë»ÈÍѤµ¤ì¤ë¤³¤È¤ò´üÂÔ¤µ¤ì¤Æ¤¤¤ë¡£
188 ¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤Ç¤Ï¡¢
190 ¤Ë»ØÄê¤Ç¤¤ëÄ´À°Î̤ËÀ©¸Â¤ò²Ý¤·¤Æ¤¤¤ë¡£
193 ¤Ï (INT_MIN / 1000000 + 2) °Ê¾å (INT_MAX / 1000000 \- 2) °Ê²¼
194 (i386 ¤Ç¤Ï \-2145 °Ê¾å 2145 °Ê²¼) ¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
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
202 .\"O was specified as NULL,
203 .\"O no valid information about the outstanding clock adjustment was returned in
205 .\"O (In this circumstance,
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.
213 .\" http://sourceware.org/bugzilla/show_bug?id=2449
214 .\" http://bugzilla.kernel.org/show_bug.cgi?id=6761
216 ¤Ë NULL ¤ò»ØÄꤹ¤ë¤È¡¢Ì¤´°Î»¤Î¥¯¥í¥Ã¥¯Ä´À°¤Ë´Ø¤¹¤ë͸ú¤Ê¾ðÊó¤¬
218 ¤ËÊÖ¤µ¤ì¤Ê¤¤¤È¤¤¤¦¥Ð¥°¤¬¤¢¤Ã¤¿ (¤³¤Î¾ì¹ç¡¢
220 ¤Ï¡¢Ì¤´°Î»¤Î¥¯¥í¥Ã¥¯Ä´À°¤Ë´Ø¤¹¤ë¾ðÊó¤ò¡¢Êѹ¹¤»¤º¤ËÊÖ¤¹¤Ù¤¤Ç¤¢¤ë)¡£
222 .\" adjtimex() ¤Î¿·¤·¤¤¥Õ¥é¥° ADJ_OFFSET_SS_READ ¤Î¤ª¤«¤²¤À¡£
223 glibc 2.8 °Ê¹ß¤Ç¡¢Linux ¥«¡¼¥Í¥ë 2.6.26 °Ê¹ß¤Î¥·¥¹¥Æ¥à¤Ç½¤Àµ¤µ¤ì¤Æ¤¤¤ë¡£
227 .BR gettimeofday (2),