.\" Copyright (c) 2006 by Michael Kerrisk .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" .\" Japanese Version Copyright (c) 2006 Akihiro MOTOKI all rights reserved. .\" Translated 2006-07-16, Akihiro MOTOKI .\" .TH ADJTIME 3 2008-06-22 "Linux" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O adjtime \- correct the time to synchronize the system clock adjtime \- システムクロックに同期する時刻を調整する .\"O .SH SYNOPSIS .SH 書式 .nf .BI "int adjtime(const struct timeval *" delta ", struct timeval *" olddelta ); .fi .sp .in -4n .\"O Feature Test Macro Requirements for glibc (see .\"O .BR feature_test_macros (7)): glibc 向けの機能検査マクロの要件 .RB ( feature_test_macros (7) 参照): .in .sp .BR adjtime (): _BSD_SOURCE .\"O .SH DESCRIPTION .SH 説明 .\"O The .\"O .BR adjtime () .\"O function gradually adjusts the system clock (as returned by .\"O .BR gettimeofday (2)). .\"O The amount of time by which the clock is to be adjusted is specified .\"O in the structure pointed to by .\"O .IR delta . .\"O This structure has the following form: .BR adjtime () 関数は .RB ( gettimeofday (2) が返す) システムクロックを徐々に調整する。 調整すべきクロックの時間量は .I delta が指す構造体で指定される。 この構造体は以下の形である: .in +4n .nf struct timeval { .\"O time_t tv_sec; /* seconds */ .\"O suseconds_t tv_usec; /* microseconds */ time_t tv_sec; /* 秒 */ suseconds_t tv_usec; /* マイクロ秒 */ }; .fi .in .PP .\"O If the adjustment in .\"O .I delta .\"O is positive, then the system clock is speeded up by some .\"O small percentage (i.e., by adding a small .\"O amount of time to the clock value in each second) until the adjustment .\"O has been completed. .\"O If the adjustment in .\"O .I delta .\"O is negative, then the clock is slowed down in a similar fashion. .I delta の調整量が正の場合、調整量に達するまでシステムクロックを 少し割合だけスピードアップさせる (つまり、毎秒クロック値に少しだけ 時刻を加算する)。 .I delta の調整量が負の場合、同様の方法でクロックを遅くする。 .\"O If a clock adjustment from an earlier .\"O .BR adjtime () .\"O call is already in progress .\"O at the time of a later .\"O .BR adjtime () .\"O call, and .\"O .I delta .\"O is not NULL for the later call, then the earlier adjustment is stopped, .\"O but any already completed part of that adjustment is not undone. .BR adjtime () が呼び出されたときに以前の .BR adjtime () の呼び出しによるクロックの調整がまだ実行中で、かつ後の .BR adjtime () の .I delta が NULL でない場合、実行中の調整は停止される。 しかし、すでに実行された調整の取り消しは行われない。 .\"O If .\"O .I olddelta .\"O is not NULL, then the buffer that it points to is used to return .\"O the amount of time remaining from any previous adjustment that .\"O has not yet been completed. .I olddelta が NULL でない場合、 .I olddelta が指すバッファに、過去の調整要求でまだ完了せず残っている時間量が 格納して返される。 .\"O .SH "RETURN VALUE" .SH 返り値 .\"O On success, .\"O .BR adjtime () .\"O returns 0. On failure, \-1 is returned, and .\"O .I errno .\"O is set to indicate the error. 成功すると、 .BR adjtime () は 0 を返す。失敗すると、\-1 を返し、 .I errno にエラーを示す値をセットする。 .\"O .SH ERRORS .SH エラー .TP .B EINVAL .\"O The adjustment in .\"O .I delta .\"O is outside the permitted range. .I delta で指定された調整量が許可された範囲に入っていない。 .TP .B EPERM .\"O The caller does not have sufficient privilege to adjust the time. .\"O Under Linux the .\"O .B CAP_SYS_TIME .\"O capability is required. 呼び出し者が時刻を調整するのに必要な権限を持っていない。 Linux では .B CAP_SYS_TIME ケーパビリティが必要である。 .\"O .SH CONFORMING TO .SH 準拠 4.3BSD, System V. .\"O .SH NOTES .SH 注意 .\"O The adjustment that .\"O .BR adjtime () .\"O makes to the clock is carried out in such a manner that the clock .\"O is always monotonically increasing. .\"O Using .\"O .BR adjtime () .\"O to adjust the time prevents the problems that can be caused for certain .\"O applications (e.g., .\"O .BR make (1)) .\"O by abrupt positive or negative jumps in the system time. .BR adjtime () が行うクロックの調整は、クロックは常に単調増加するという範囲内で 実行される。 .BR adjtime () を使って時刻を調整することで、システムタイムの突然の正や負のジャンプ により、いくつかのアプリケーション (例えば .BR make (1) など) に起こる問題を防ぐことができる。 .\"O .BR adjtime () .\"O is intended to be used to make small adjustments to the system time. .\"O Most systems impose a limit on the adjustment that can be specified in .\"O .IR delta . .\"O In the glibc implementation, .\"O .I delta .\"O must be less than or equal to (INT_MAX / 1000000 \- 2) .\"O and greater than or equal to (INT_MIN / 1000000 + 2) .\"O (respectively 2145 and \-2145 seconds on i386). .BR adjtime () はシステム時刻に少しずつ調整を行うために使用されることを期待されている。 ほとんどのシステムでは、 .I delta に指定できる調整量に制限を課している。 glibc の実装では、 .I delta は (INT_MIN / 1000000 + 2) 以上 (INT_MAX / 1000000 \- 2) 以下 (i386 では \-2145 以上 2145 以下) でなければならない。 .\"O .SH BUGS .SH バグ .\"O A longstanding bug .\"O .\" http://sourceware.org/bugzilla/show_bug?id=2449 .\"O .\" http://bugzilla.kernel.org/show_bug.cgi?id=6761 .\"O meant that if .\"O .I delta .\"O was specified as NULL, .\"O no valid information about the outstanding clock adjustment was returned in .\"O .IR olddelta . .\"O (In this circumstance, .\"O .BR adjtime () .\"O should return the outstanding clock adjustment, without changing it.) .\"O This bug is fixed .\"O .\" Thanks to the new adjtimex() ADJ_OFFSET_SS_READ flag .\"O on systems with glibc 2.8 or later and .\"O Linux kernel 2.6.26 or later. ずっと昔から、 .\" http://sourceware.org/bugzilla/show_bug?id=2449 .\" http://bugzilla.kernel.org/show_bug.cgi?id=6761 .I delta に NULL を指定すると、未完了のクロック調整に関する有効な情報が .I olddelta に返されないというバグがあった (この場合、 .BR adjtime () は、未完了のクロック調整に関する情報を、変更せずに返すべきである)。 このバグは、 .\" adjtimex() の新しいフラグ ADJ_OFFSET_SS_READ のおかげだ。 glibc 2.8 以降で、Linux カーネル 2.6.26 以降のシステムで修正されている。 .\"O .SH "SEE ALSO" .SH 関連項目 .BR adjtimex (2), .BR gettimeofday (2), .BR time (7)