.\" Copyright (c) 2006 by Michael Kerrisk .\" .\" %%%LICENSE_START(VERBATIM) .\" 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. .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2006 Akihiro MOTOKI all rights reserved. .\" Translated 2006-07-16, Akihiro MOTOKI .\" .TH ADJTIME 3 2014\-05\-28 Linux "Linux Programmer's Manual" .SH 名前 adjtime \- システムクロックに同期する時刻を調整する .SH 書式 .nf \fB#include \fP .sp \fBint adjtime(const struct timeval *\fP\fIdelta\fP\fB, struct timeval *\fP\fIolddelta\fP\fB);\fP .fi .sp .in -4n glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .in .sp \fBadjtime\fP(): _BSD_SOURCE .SH 説明 \fBadjtime\fP() 関数は (\fBgettimeofday\fP(2) が返す) システムクロックを徐々に調整する。 調整すべきクロックの時間量は \fIdelta\fP が指す構造体で指定される。 この構造体は以下の形である: .in +4n .nf struct timeval { time_t tv_sec; /* 秒 */ suseconds_t tv_usec; /* マイクロ秒 */ }; .fi .in .PP \fIdelta\fP の調整量が正の場合、調整量に達するまでシステムクロックを 少し割合だけスピードアップさせる (つまり、毎秒クロック値に少しだけ 時刻を加算する)。 \fIdelta\fP の調整量が負の場合、同様の方法でクロックを遅くする。 \fBadjtime\fP() が呼び出されたときに以前の \fBadjtime\fP() の呼び出しによるクロックの調整がまだ実行中で、かつ後の \fBadjtime\fP() の \fIdelta\fP が NULL でない場合、実行中の調整は停止される。 しかし、すでに実行された調整の取り消しは行われない。 \fIolddelta\fP が NULL でない場合、 \fIolddelta\fP が指すバッファーに、過去の調整要求でまだ完了せず残っている時間量が 格納して返される。 .SH 返り値 成功すると、 \fBadjtime\fP() は 0 を返す。失敗すると、\-1 を返し、 \fIerrno\fP にエラーを示す値をセットする。 .SH エラー .TP \fBEINVAL\fP \fIdelta\fP で指定された調整量が許可された範囲に入っていない。 .TP \fBEPERM\fP 呼び出し者が時刻を調整するのに必要な権限を持っていない。 Linux では \fBCAP_SYS_TIME\fP ケーパビリティが必要である。 .SH 属性 .SS "マルチスレッディング (pthreads(7) 参照)" \fBadjtime\fP() 関数はスレッドセーフである。 .SH 準拠 4.3BSD, System V. .SH 注意 \fBadjtime\fP() が行うクロックの調整は、クロックは常に単調増加するという範囲内で 実行される。 \fBadjtime\fP() を使って時刻を調整することで、システムタイムの突然の正や負のジャンプ により、いくつかのアプリケーション (例えば \fBmake\fP(1) など) に起こる問題を防ぐことができる。 \fBadjtime\fP() はシステム時刻に少しずつ調整を行うために使用されることを期待されている。 ほとんどのシステムでは、 \fIdelta\fP に指定できる調整量に制限を課している。 glibc の実装では、 \fIdelta\fP は (INT_MIN / 1000000 + 2) 以上 (INT_MAX / 1000000 \- 2) 以下 (i386 では \-2145 以上 2145 以下) でなければならない。 .SH バグ .\" http://sourceware.org/bugzilla/show_bug?id=2449 .\" http://bugzilla.kernel.org/show_bug.cgi?id=6761 .\" Thanks to the new adjtimex() ADJ_OFFSET_SS_READ flag ずっと昔から、 \fIdelta\fP に NULL を指定すると、未完了のクロック調整に関する有効な情報が \fIolddelta\fP に返されないというバグがあった (この場合、 \fBadjtime\fP() は、未完了のクロック調整に関する情報を、変更せずに返すべきである)。 このバグは、 glibc 2.8 以降で、Linux カーネル 2.6.26 以降のシステムで修正されている。 .SH 関連項目 \fBadjtimex\fP(2), \fBgettimeofday\fP(2), \fBtime\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。