// © Copyright 1995. Joseph Bergin. All rights reserved.

#ifndef __StopWatch__
#define __StopWatch__

#include <time.h>

// A StopWatch is a general purpose interval timer.  It measures
// elapsed time from creation or the last reset.  The timer always
// prints on cout (could be improved).  

class StopWatch
{	public:
		StopWatch();
			// Start a new timer at system reference time 
			// (UNIX and PC: GMT 0:0:0 Jan 1 1970)
			// (Macintosh: Midnight Jan 1 1904)
			// The resolution is one second.  
			
		StopWatch (const StopWatch &d);
		~StopWatch();
		StopWatch & operator = (const StopWatch &d);
		
		time_t start();
			// Returns the absolute time of start.
			
		time_t stop();
			// Returns the absolute time of stop.
			
		time_t mark();
			// Returns the absolute time of mark.
			// Prints the elapsed time (seconds) since start
			//    and the elapsed time since last mark.
			
		void reset();
			// Resets all times to system reference time.  
	private:
		time_t _startTime;
		time_t _markTIme;
		time_t _stopTime;
};


#endif


