Evo C++ Library v0.5.1
Public Types | Public Member Functions | List of all members
TimerT< T > Class Template Reference

#include <evo/timer.h>

Detailed Description

template<class T = TimerStampWall>
class evo::TimerT< T >

Timer that works like a stopwatch.

Public Types

typedef TimerT< T > This
 This type. More...
 

Public Member Functions

 TimerT ()
 Constructor. More...
 
 TimerT (const This &src)
 Copy constructor. More...
 
bool active () const
 Get whether timer is active (started). More...
 
void clear ()
 Stop and clear timer. More...
 
ulongl msec () const
 Get current time elapsed in milliseconds. More...
 
ulongl nsec () const
 Get current time elapsed in nanoseconds. More...
 
Thisoperator= (const This &src)
 Assignment/Copy operator. More...
 
void resume ()
 Resume timer from last stop. More...
 
double sec () const
 Get current time elapsed in floating-point seconds (with fraction). More...
 
void start ()
 Start timer. More...
 
Thisstop ()
 Stop timer. More...
 
ulongl usec () const
 Get current time elapsed in microseconds. More...
 

Member Typedef Documentation

◆ This

typedef TimerT<T> This

This type.

Constructor & Destructor Documentation

◆ TimerT() [1/2]

TimerT ( )
inline

Constructor.

◆ TimerT() [2/2]

TimerT ( const This src)
inline

Copy constructor.

Parameters
srcSource to copy

Member Function Documentation

◆ active()

bool active ( ) const
inline

Get whether timer is active (started).

Returns
Whether active, false if not started

◆ clear()

void clear ( )
inline

Stop and clear timer.

◆ msec()

ulongl msec ( ) const
inline

Get current time elapsed in milliseconds.

  • If timer is active then this gives time elapsed so far, otherwise time elapsed from last start/stop
Returns
Time elapsed in milliseconds

◆ nsec()

ulongl nsec ( ) const
inline

Get current time elapsed in nanoseconds.

  • If timer is active then this gives time elapsed so far, otherwise time elapsed from last start/stop
Returns
Time elapsed in nanoseconds

◆ operator=()

This& operator= ( const This src)
inline

Assignment/Copy operator.

Parameters
srcSource to copy
Returns
This

◆ resume()

void resume ( )
inline

Resume timer from last stop.

  • This starts timer again like a stopwatch
  • If timer never started then this is same as start()
  • Call stop() to stop timer

◆ sec()

double sec ( ) const
inline

Get current time elapsed in floating-point seconds (with fraction).

  • If timer is active then this gives time elapsed so far, otherwise time elapsed from last start/stop
Returns
Time elapsed in seconds

◆ start()

void start ( )
inline

Start timer.

  • This clears stored elapsed time
  • Call stop() to stop timer

◆ stop()

This& stop ( )
inline

Stop timer.

  • Time elapsed is stored internally
  • Timer may started again with start() or resume()

◆ usec()

ulongl usec ( ) const
inline

Get current time elapsed in microseconds.

  • If timer is active then this gives time elapsed so far, otherwise time elapsed from last start/stop
Returns
Time elapsed in microseconds

The documentation for this class was generated from the following file: