Trading System API  3.0
Library for Simulating and Deploying Trading and Investment Strategies
tsa::timer Class Reference

A timer. More...

#include <TSASupport.h>

Inheritance diagram for tsa::timer:
tsa::object

Public Types

Public Member Functions

 timer (init_flag flag=timer::started)
 Constructor. By default the timer will start timing immediately when constructed. Pass the timer::stopped flag to just construct the object. You need to call start() explicitly to start timing. More...
 
 ~timer (void)
 Destructor.
 
double milliseconds (void) const
 Returns the number of milliseconds elapsed as a floating point number. More...
 
double seconds (void) const
 Returns the number of seconds elapsed as a floating point number. More...
 
void start (void)
 Starts timing.
 
const timerstop (void)
 Stops the timer. More...
 
- Public Member Functions inherited from tsa::object
 object (void)
 Constructor.
 
virtual ~object (void)
 Destructor.
 
const char * class_name (void) const
 Returns the class name as returned by the 'Real Time Type Information' (RTTI) mechanism. More...
 
bool has_same_class_as (const object &other) const
 Returns true if self has the same type as other object. More...
 

Detailed Description

A timer.

Member Enumeration Documentation

Timer constructor flag.

Enumerator
stopped 

Construct the timer object, but do not start timing.

See also
start()
started 

Start the timer immediately upon construction.

Constructor & Destructor Documentation

tsa::timer::timer ( timer::init_flag  f = timer::started)

Constructor. By default the timer will start timing immediately when constructed. Pass the timer::stopped flag to just construct the object. You need to call start() explicitly to start timing.

Parameters
flagConstructor flag.

Member Function Documentation

double tsa::timer::milliseconds ( void  ) const

Returns the number of milliseconds elapsed as a floating point number.

Returns
A double.
double tsa::timer::seconds ( void  ) const

Returns the number of seconds elapsed as a floating point number.

Returns
A double.
const timer & tsa::timer::stop ( void  )

Stops the timer.

Returns
Returns self so that the stopped timer can immediately be written to a stream.