#include <stopwatch.h>
Public Member Functions | |
stopwatch () | |
Constructor. | |
void | start () |
Start the stopwatch. | |
double | time () |
Get the current time of the stopwatch. | |
double | stop () |
Stop the stopwatch, get the time. |
This class encapsulates the system's timing functions. I've found that Mac and Linux use very different versions of time.h, and with different clock resolutions. Rather than deal with it in the silly C-style (this is C++ after all), I created a simple stopwatch class.
stopwatch::stopwatch | ( | ) | [inline] |
Constructor.
void stopwatch::start | ( | ) |
double stopwatch::stop | ( | ) |
Stop the stopwatch, get the time.
This returns the stopwatch's current time and does stop it. Returns the time in seconds as a double
double stopwatch::time | ( | ) |
Get the current time of the stopwatch.
This returns the stopwatch's current time without stopping it. Returns the time in seconds as a double