バナーをクリックすれば目次に戻ります
Copyright 1999 Rogue Wave Software
Copyright 1999 Sun Microsystems, Inc.
RWTimer
#include <rw/timer.h> RWTimer timer;
タイマーは、メンバー関数 start() を呼び出して "実行" 状態に入り、stop() を呼び出して "休止" 状態に入ります。RWTimer はシステムに依存する関数 clock() を使用します。この関数は初めて呼び出されたときからの "ティック" 数を返します。この結果 RWTimer は、システムに依存する特定の値より長い間隔を計測できません。(たとえば、いくつかの UNIX システムでは、この値は 36 分よりやや少ない値です。)
#include <rw/timer.h> #include <rw/rwtime.h> #include <rw/rstream.h> main() {RWTimer t; t.start(); // タイマーを開始する RWTime start; start.now(); // 開始時刻を記録する // 5 秒間ループする for (RWTime current; current.seconds() - start.seconds() < 5; current = RWTime::now()) {;} t.stop(); // タイマーを停止する cout << t.elapsedTime() << endl; return 0; } |
5.054945 |
RWTimer();
double elapsedTime() const;
void reset();
void start();
void stop();