//Programmer: Bo Bayles  Date: 15 November 2004
//File: StopWatch.cpp    Class: CS54 C
//Purpose: This is the implementation file for the
//  StopWatch class functions.

#include "StopWatch.h"
#include <ctime>
#include <iostream>
using namespace std;
//Include the necessary headers.

StopWatch::StopWatch()
{
  iStartTime = 0;
  iElapsedTime = 0;
}
//Default constructor: Initialize the times to 0.

void StopWatch::start()
{
  iStartTime = time(NULL);
}
//Set the start time to the current time.

void StopWatch::stop()
{
  iElapsedTime = time(NULL) - iStartTime;
}
//Set the elapsed time to the current time minus the start time.

void StopWatch::reset()
{
  iStartTime = 0;
  iElapsedTime = 0;
}
//Reset the times to zero.

int StopWatch::getElapsedTime()
{
  return iElapsedTime;
}
//Accessor: Return the elapsed time.


