.\" Copyright (c) 1990, 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. .\" .\" @(#)times.3 8.1 (Berkeley) 6/4/93 .\" %FreeBSD: src/lib/libc/gen/times.3,v 1.4.2.4 2001/12/14 18:33:51 ru Exp % .\" .\" $FreeBSD$ .Dd June 4, 1993 .Dt TIMES 3 .Os .Sh 名称 .Nm times .Sh ライブラリ .Lb libc .Nd 時間の処理 .Sh 書式 .In sys/times.h .Ft clock_t .Fn times "struct tms *tp" .Sh 解説 .Bf -symbolic このインタフェースは、関数 .Xr getrusage 2 および .Xr gettimeofday 3 に置き換えられています。 .Ef .Pp .Fn times 関数は、1970 年 1 月 1 日 0 時 0 分 0 秒で調整された世界時から測った .Dv CLK_TCK の時間値を秒で返します。 .Pp この関数は、 .Fa tp により指示された構造に時間計測情報を書込みます。 .Pp .Vt tms 構造は、次のように定義されます: .Bd -literal -offset indent struct tms { clock_t tms_utime; clock_t tms_stime; clock_t tms_cutime; clock_t tms_cstime; }; .Ed .Pp この構造の要素は、次のように定義されます: .Bl -tag -width ".Va tms_cutime" .It Va tms_utime ユーザインストラクションの実行に対して請求される .Tn CPU タイム。 .It Va tms_stime その処理のためのシステムによる実行に対して請求される .Tn CPU タイム。 .It Va tms_cutime 子プロセスの .Va tms_utime s および .Va tms_cutime s の和。 .It Va tms_cstime 子プロセスの .Va tms_stime Ns s および .Va tms_cstime Ns s の和。 .El .Pp すべての時間は、 .Dv CLK_TCK 秒で表されます。 .Pp 終了した子プロセスの時間は、 .Xr wait 2 関数の 1 つが終了した子のプロセス ID をその親に返したときに、その親の .Va tms_cutime および .Va tms_cstime の要素にインクルードされます。エラーが起きた場合は、 .Fn times 関数は値 .Pq Po Vt clock_t Pc Ns \-1 を返し、エラーを示す .Va errno を設定します。 .Sh エラー .Fn times 関数が失敗すると、ライブラリルーチン .Xr getrusage 2 および .Xr gettimeofday 2 に指定されたすべてのエラーに対して、グローバル変数 .Va errno を設定する場合があります。 .Sh 関連項目 .Xr time 1 , .Xr getrusage 2 , .Xr gettimeofday 2 , .Xr wait 2 , .Xr clocks 7 .Pp .Sh 規格 .Fn times 関数は、 .St -p1003.1-88 に準拠しています。