#ifndef TIMER_H #define TIMER_H /////////////////////////////////////////////////////////////// // timer.h -- determine elapsed time // // ver 1.0 // // Language: Visual C++, ver 6.0 // // Platform: Micron Dual Pentium Pro 200, Win NT 4.0 // // Application: Demo for CSE691 Pr4, Fall 1998 // // Author: Jim Fawcett, CST 2-187, Syracuse Univ. // // (315) 443-3948, fawcett@ecs.syr.edu // /////////////////////////////////////////////////////////////// /* Class Operations ================ Timer objects start running when they are constructed. They count time in milliseconds. If started, they reset their time count from that instant. When stopped they remember the elaspsed time since being constructed or started, whichever is the more recent. timer t1, t2; // start timers t1 and t2 t1.start(); // restart timer t1 t2.stop(); // stop t2 t1.elapsed(); // return number of msecs since start t2.elapsed(); // return number of msecs since constr. /////////////////////////////////////////////////////////////// // Build Process // /////////////////////////////////////////////////////////////// // Files Required: // // timer.h, timer.cpp // // // // compiler command: // // cl /GX /D TEST_TIMER timer.cpp // // // /////////////////////////////////////////////////////////////// Maintenance History: ==================== ver 1.0 : 14 Nov 98 - first release */ // #include // defines clock_t long int // defines CLOCKS_PER_SEC 1000 // defines clock_t clock() returns clock ticks (one per millisec) // since process started class timer { public: timer(); ~timer(); clock_t start(); clock_t stop(); clock_t elapsed(); private: bool isRunning; clock_t startTime; clock_t endTime; }; #endif