aboutsummaryrefslogtreecommitdiff
path: root/documentation/manual-pages/ja/man2/clock_gettime.2
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/manual-pages/ja/man2/clock_gettime.2')
-rw-r--r--documentation/manual-pages/ja/man2/clock_gettime.2130
1 files changed, 130 insertions, 0 deletions
diff --git a/documentation/manual-pages/ja/man2/clock_gettime.2 b/documentation/manual-pages/ja/man2/clock_gettime.2
new file mode 100644
index 0000000000..45f3ff2f4d
--- /dev/null
+++ b/documentation/manual-pages/ja/man2/clock_gettime.2
@@ -0,0 +1,130 @@
+.\" $OpenBSD: clock_gettime.2,v 1.4 1997/05/08 20:21:16 kstailey Exp $
+.\"
+.\" Copyright (c) 1980, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" %FreeBSD: src/lib/libc/sys/clock_gettime.2,v 1.20 2004/07/02 23:52:13 ru Exp %
+.\" $FreeBSD$
+.\"
+.Dd June 17, 2004
+.Dt CLOCK_GETTIME 2
+.Os
+.Sh 名称
+.Nm clock_gettime ,
+.Nm clock_settime ,
+.Nm clock_getres
+.Nd 日付と時刻の取得/設定/精度の取得をする
+.Sh ライブラリ
+.Lb libc
+.Sh 書式
+.In sys/time.h
+.Ft int
+.Fn clock_gettime "clockid_t clock_id" "struct timespec *tp"
+.Ft int
+.Fn clock_settime "clockid_t clock_id" "const struct timespec *tp"
+.Ft int
+.Fn clock_getres "clockid_t clock_id" "struct timespec *tp"
+.Sh 解説
+.Fn clock_gettime
+と
+.Fn clock_settime
+は
+.Fa clock_id
+で指定するクロックの値を取得、設定します。
+.Pp
+.Fa clock_id
+引数には、次の 4 つの値のうちの 1 つを指定します。
+CLOCK_REALTIME は普通の時計のように進む時間、
+CLOCK_MONOTONIC は SI 単位系の秒で進む時間、
+CLOCK_VIRTUAL は呼び出しプロセスのために CPU がユーザモードで
+実行されているときにだけ進む時間、
+CLOCK_PROF は、CPU がユーザモードまたはカーネルモードで実行されている
+ときに進む時間です。
+.Pp
+.Fa tp
+によって指される構造体は
+.In sys/time.h
+内で次のように定義されています。
+.Pp
+.Bd -literal
+struct timespec {
+ time_t tv_sec; /* 秒 */
+ long tv_nsec; /* ナノ秒 */
+};
+.Ed
+.Pp
+時刻を設定できるのはスーパユーザだけです。
+システムの安全性レベル (securelevel) が 1 より大きい場合
+.Pf ( Xr init 8
+を参照)、
+時間は進めることだけができます。
+この制限は、悪意のあるスーパユーザがファイルに
+任意のタイムスタンプを設定するのを防止するためのものです。
+しかし、システムが安全なモードの時でも、
+.Xr adjtime 2
+システムコールを使用すれば
+システム時間を遅らせることができてしまいます。
+.Pp
+クロックの精度 (細かさ) は、
+.Fn clock_getres
+システムコールによって返されます。
+この値は、(非 NULL ポインタ)
+.Fa *tp
+内に格納されます。
+.Sh 戻り値
+.Rv -std
+.Sh エラー
+次のエラーコードが
+.Va errno
+に設定されます:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+.Fa clock_id
+引数が有効な値ではありませんでした。
+.It Bq Er EFAULT
+.Fa *tp
+引数アドレスが無効なメモリを参照しています。
+.It Bq Er EPERM
+スーパユーザ以外のユーザが時刻を設定しようとしました。
+.El
+.Sh 関連項目
+.Xr date 1 ,
+.Xr adjtime 2 ,
+.Xr ctime 3 ,
+.Xr timed 8
+.Sh 規格
+.Fn clock_gettime ,
+.Fn clock_settime
+および
+.Fn clock_getres
+システムコールは
+.St -p1003.1b-93
+に適合しています。