// // Programmer: Craig Stuart Sapp // Creation Date: Sat Sep 19 12:40:20 PDT 1998 // Last Modified: Sat Sep 19 13:13:34 PDT 1998 // Filename: .../sig/doc/classes/Timer/examples/ex-1-Timer.cc // Syntax: C++ // $Smake: g++ -O -o %b -lsig %f && strip %b // // Description: This program will count to 10, with one number // displayed per second. The timer is counting // in milliseconds. The flush command in the print // statement prevents buffering of the counted // number by forcing it to print immediately. #include "Timer.h" #include int main(void) { Timer stopwatch; int counter = 0; stopwatch.reset(); while (counter <= 10) { if (stopwatch.getTime() > counter * 1000) { cout << counter << " " << flush; counter++; } } cout << endl; return 0; }