| 総合手引 | セクション 2 | English | オプション |
#include <sys/time.h>
clock_id 引数には、次の 4 つの値のうちの 1 つを指定します。 CLOCK_REALTIME は普通の時計のように進む時間、 CLOCK_MONOTONIC は SI 単位系の秒で進む時間、 CLOCK_VIRTUAL は呼び出しプロセスのために CPU がユーザモードで 実行されているときにだけ進む時間、 CLOCK_PROF は、CPU がユーザモードまたはカーネルモードで実行されている ときに進む時間です。
tp によって指される構造体は <sys/time.h> 内で次のように定義されています。
struct timespec {
time_t tv_sec; /* 秒 */
long tv_nsec; /* ナノ秒 */
};
時刻を設定できるのはスーパユーザだけです。 システムの安全性レベル (securelevel) が 1 より大きい場合 (init(8) を参照)、 時間は進めることだけができます。 この制限は、悪意のあるスーパユーザがファイルに 任意のタイムスタンプを設定するのを防止するためのものです。 しかし、システムが安全なモードの時でも、 adjtime(2) システムコールを使用すれば システム時間を遅らせることができてしまいます。
クロックの精度 (細かさ) は、 clock_getres() システムコールによって返されます。 この値は、(非 NULL ポインタ) *tp 内に格納されます。
| [EINVAL] | |
| clock_id 引数が有効な値ではありませんでした。 | |
| [EFAULT] | |
| *tp 引数アドレスが無効なメモリを参照しています。 | |
| [EPERM] | |
| スーパユーザ以外のユーザが時刻を設定しようとしました。 | |
| CLOCK_GETTIME (2) | June 17, 2004 |
| 総合手引 | セクション 2 | English | オプション |
このマニュアルページサービスについてのご意見は Ben Bullock にお知らせください。 Privacy policy.
| “ | Our grievance is not just against Unix itself, but against the cult of Unix zealots who defend and nurture it. They take the heat, disease, and pestilence as givens, and, as ancient shamans did, display their wounds, some self-inflicted, as proof of their power and wizardry. We aim, through bluntness and humor, to show them that they pray to a tin god, and that science, not religion, is the path to useful and friendly technology. | ” |
| — The Unix Haters' handbook | ||