8#ifndef Sawyer_Stopwatch_H 
    9#define Sawyer_Stopwatch_H 
   11#include <Sawyer/Sawyer.h> 
   13#ifdef SAWYER_HAVE_BOOST_CHRONO 
   14# include <boost/chrono/duration.hpp> 
   15# include <boost/chrono/system_clocks.hpp> 
   43#ifdef SAWYER_HAVE_BOOST_CHRONO 
   44    typedef boost::chrono::high_resolution_clock::time_point TimePoint;
 
   45    typedef boost::chrono::duration<double> Duration;
 
   47    typedef double TimePoint;
 
   48    typedef double Duration;
 
   52#include <Sawyer/WarningsOff.h> 
   53    mutable TimePoint begin_ = 0.0;                     
 
   54    mutable Duration elapsed_ = 0.0;                    
 
   55    bool running_ = 
false;                              
 
   56#include <Sawyer/WarningsRestore.h> 
   63        start && this->start();
 
 
   91    double stop(
bool clear=
false);
 
   97    double report(
bool clear=
false) 
const;
 
 
  112SAWYER_EXPORT std::ostream& operator<<(std::ostream&, 
const Stopwatch&);
 
double clear(double value=0.0)
Stop and reset the timer to the specified value.
 
double report(bool clear=false) const
Report current accumulated time without stopping or starting.
 
double start(double value)
Start the timer and report accumulated time.
 
static std::string toString(double seconds)
Format time in human readable manner.
 
bool isRunning() const
Query state of stopwatch.
 
double stop(bool clear=false)
Stop the timer and report accumulated time.
 
double restart()
Restart the timer.
 
std::string toString() const
Convert a stopwatch to a human-readalbe string.
 
double start()
Start the timer and report accumulated time.
 
Stopwatch(bool start=true)
Construct and optionally start a timer.