JM プロジェクトは、主に Linux 関連のマニュアルページの日本語ページを翻訳・公開しています。
... library ( librt ,\ -lrt ) 書式 #include < time.h > int clock_getres(clockid_t clockid , struct timespec *_Nullable res ); int clock_gettime(clockid_t clockid , struct timespec * tp ); ... int clock_settime(clockid_t clockid , const struct timespec * tp ); glibc 向けの機能検査マクロの要件 ( feature_test_macros (7) 参照) ... : clock_getres (), clock_gettime (), clock_settime (): _POSIX_C_SOURCE >= 199309L 説明 関数 clock_getres () は 指定されたクロック ... ... library ( librt ,\ -lrt ) 書式 #include < time.h > int clock_getres(clockid_t clockid , struct timespec *_Nullable res ); int clock_gettime(clockid_t clockid , struct timespec * tp ); ... int clock_settime(clockid_t clockid , const struct timespec * tp ); glibc 向けの機能検査マクロの要件 ( feature_test_macros (7) 参照) ... : clock_getres (), clock_gettime (), clock_settime (): _POSIX_C_SOURCE >= 199309L 説明 関数 clock_getres () は 指定されたクロック ... ... library ( librt ,\ -lrt ) 書式 #include < time.h > int clock_getres(clockid_t clockid , struct timespec *_Nullable res ); int clock_gettime(clockid_t clockid , struct timespec * tp ); ... int clock_settime(clockid_t clockid , const struct timespec * tp ); glibc 向けの機能検査マクロの要件 ( feature_test_macros (7) 参照) ... : clock_getres (), clock_gettime (), clock_settime (): _POSIX_C_SOURCE >= 199309L 説明 関数 clock_getres () は 指定されたクロック ... ... library ( librt ,\ -lrt ) 書式 #include < time.h > int clock_nanosleep(clockid_t clockid , int flags , const struct timespec * t , struct timespec *_Nullable remain ); glibc 向けの機能 ... 検査マクロの要件 ( feature_test_macros (7) 参照): clock_nanosleep (): _POSIX_C_SOURCE >= 200112L 説明 clock_nanosleep () を使うと、 nanosleep (2) 同様、ナノ秒の精度で指定された期 ... きる点です。 この呼び出しに渡される時刻値と、この呼び出しから返される時刻値は、 timespec (3) 構造体を使用して指定されます。 clockid 引数で、停止期間をどのクロックに対して計測するかを指定します。この引数には以下の値のいずれか一つを指定できます。 CLOCK_R ... ... は、Real-time library ( librt ,\ -lrt ) 書式 #include < time.h > int clock_getcpuclockid(pid_t pid , clockid_t * clockid ); glibc 向けの機能検査マクロの要件 ( feature_test_macros (7) 参照): clock_g ... etcpuclockid (): _POSIX_C_SOURCE >= 200112L 説明 clock_getcpuclockid () 関数は、 プロセス ID が pid のプロセスの CPU 時刻のクロック I ... D を取得し、 その ID を clockid が指す場所に入れて返します。 pid が 0 の場合、呼び出し元のプロセスの CPU 時刻のクロック ID が返されます。 返り値 成功する ... ... ロセッサ時間の近似値を返します。 返り値 返り値は clock_t 単位での CPU 時間です。秒単位での値を得るためには CLOCKS_PER_SEC で割ります。使用したプロセッサ時間が得られない場合や、そ ... の値を表現できない場合、この関数は (clock_t) -1 を返します。 属性 この節で使用されている用語の説明については、 attributes (7) を参照してください。 インターフェース ... 属性 値 clock () Thread safety MT-Safe バージョン XSI は実際の精度にはよらず CLOCKS_PER_SEC が 1000000 であることを要求しています。 実装 ... ... ルは vDSO で公開されるシンボルの一覧である。 シンボル バージョン __vdso_gettimeofday LINUX_2.6 (Linux 4.1 以降で公開) __vdso_clock_gettime LINUX_2.6 (Linux 4.1 以降で公開) Additionally, the ARM port has a code page full of utility functions. Since it's ... るシンボルの一覧である。 シンボル バージョン __kernel_rt_sigreturn LINUX_2.6.39 __kernel_gettimeofday LINUX_2.6.39 __kernel_clock_gettime LINUX_2.6.39 __kernel_clock_getres LINUX_2.6.39 bfin (Blackfin) functions (port removed in Linux 4.17) As this CPU ... DSO で公開されるシンボルの一覧である。 シンボル バージョン __kernel_gettimeofday LINUX_2.6 (Linux 4.4 以降で公開) __kernel_clock_gettime LINUX_2.6 (Linux 4.4 以降で公開) ia64 (Itanium) 関数 以下のテーブルは vDSO で公開されるシンボルの一覧である。 シン ... ... 時間を buf が指している struct tms に格納します。 struct tms は < sys/times.h > で以下のように定義されています: struct tms { clock_t tms_utime; /* user time */ clock_t tms_stime; /* system time */ clock_t tms_cutime; /* user time of children */ clock_t ... セスの時間は決して現れません。 全ての時間はクロック数で返されます。 返り値 times () は過去のある時点から経過したクロック数 (clock tick) を返します。この戻り値は clock_t 型が取り得る範囲からオーバーフローするかもしれません。エラーの場合、 (clock_t) -1 が ... 点はシステム起動時刻の (2^32/HZ) - 300 秒前です。このようにカーネルバージョン (や UNIX の実装) により異なることと、 返り値が clock_t の範囲をオーバーフローする可能性があるという事実を考慮すると、 移植性が必要なアプリケーションではこの値を使うのは避けるの ... ... id(pthread_t thread , clockid_t * clockid ); -pthread でコンパイルしてリンクする。 説明 The pthread_getcpuclockid () function obtains the ID of the CP ... U-time clock of the thread whose ID is given in thread , and returns it in the location pointed to by clockid . 返り値 成功すると、この ... 用できる。 属性 この節で使用されている用語の説明については、 attributes (7) を参照。 インターフェース 属性 値 pthread_getcpuclockid () Thread safety MT-Safe 準拠 POSIX.1-2001, POSIX.1-2008. 注意 thread が呼び出したスレッドを参照している場合、 クロック ... ... . If thread has not yet terminated, then the call blocks until a maximum time, specified in abstime , measured against the CLOCK_REALTIME clock. If the timeout expires before thread terminates, the call returns an error. The abstime argument is a stru ... 移植性がない) という接尾辞が 付いている。 例 以下のコードは、最大 5 秒まで join を待つ。 struct timespec ts; int s; ... if (clock_gettime(CLOCK_REALTIME, &ts) == -1) { /* Handle error */ } ts.tv_sec += 5; s = pthread_timedjoin_np(thread, NULL, &ts); if ... medjoin_np () function measures time by internally calculating a relative sleep interval that is then measured against the CLOCK_MONOTONIC clock instead of the CLOCK_REALTIME clock. Consequently, the timeout is unaffected by discontinuous changes to t ... 日本語の文書やマニュアルを配布している個人/プロジェクトへのリンクです。