時間

時間

一秒ずつ寝る
sleep(1);
クロック数で時間を測る
<ctime> clock()を使う。他プロセスがいると,time() と結果が異なる。

clock_t start,end;
start = clock();
  /* むにゃむにゃ */
end = clock();
cout << (double)(end-start) / CLOCKS_PER_SEC;
実時間で時間を測る
<ctime> time()を使う。精度は clock() より低い。

time_t start,end;
start = time(NULL);
  /* むにゃむにゃ */
end = clock(NULL);
cout << (double)(end-start);
最終更新:2010年01月07日 11:01
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。